403Webshell
Server IP : 151.101.66.159  /  Your IP : 216.73.216.66
Web Server : Flywheel/5.1.0
System : Linux wordpress 6.12.113+ #1 SMP Thu Oct 22 02:38:20 UTC 2026 x86_64
User : root ( )
PHP Version : 7.4.33.18
Disable Function : disk_free_space,diskfreespace,dl,exec,fpassthru,getmypid,getmyuid,highlight_file,link,opcache_compile_file,opcache_get_configuration,opcache_is_script_cached,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifcontinued,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,phpinfo,popen,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,socket_listen,source,system,virtual
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /www/wp-content/plugins/file-manager-advanced/application/assets/dist/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/wp-content/plugins/file-manager-advanced/application/assets/dist/906.83d62c0b.chunk.js
/*! For license information please see 906.83d62c0b.chunk.js.LICENSE.txt */
"use strict";(self.webpackChunkafm_react_admin=self.webpackChunkafm_react_admin||[]).push([[906],{3906(e,t,n){n.r(t),n.d(t,{default:()=>Yt});var r=n(6540);function o(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function s(n,r,o,a){var s=r&&r.prototype instanceof c?r:c,u=Object.create(s.prototype);return i(u,"_invoke",function(n,r,o){var i,a,s,c=0,u=o||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return i=t,a=0,s=e,p.n=n,l}};function f(n,r){for(a=n,s=r,t=0;!d&&c&&!o&&t<u.length;t++){var o,i=u[t],f=p.p,g=i[2];n>3?(o=g===r)&&(s=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=f&&((o=n<2&&f<i[1])?(a=0,p.v=r,p.n=i[1]):f<g&&(o=n<3||i[0]>r||r>g)&&(i[4]=n,i[5]=r,p.n=g,a=0))}if(o||n>1)return l;throw d=!0,r}return function(o,u,g){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,g),a=u,s=g;(t=a<2?e:s)||!d;){i||(a?a<3?(a>1&&(p.n=-1),f(a,s)):p.n=s:p.v=s);try{if(c=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(d=p.n<0)?s:n.call(r,p))!==l)break}catch(t){i=e,a=1,s=t}finally{c=1}}return{value:t,done:d}}}(n,o,a),!0),u}var l={};function c(){}function u(){}function d(){}t=Object.getPrototypeOf;var p=[][r]?t(t([][r]())):(i(t={},r,function(){return this}),t),f=d.prototype=c.prototype=Object.create(p);function g(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,i(e,a,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=d,i(f,"constructor",d),i(d,"constructor",u),u.displayName="GeneratorFunction",i(d,a,"GeneratorFunction"),i(f),i(f,a,"Generator"),i(f,r,function(){return this}),i(f,"toString",function(){return"[object Generator]"}),(o=function(){return{w:s,m:g}})()}function i(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}i=function(e,t,n,r){function a(t,n){i(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},i(e,t,n,r)}function a(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t,n,i){var l=s((0,r.useState)(!1),2),c=l[0],u=l[1],d=s((0,r.useState)(!1),2),p=d[0],f=d[1],g=function(){var r,s=(r=o().m(function r(){var a,s,l,c,d,p;return o().w(function(r){for(;;)switch(r.p=r.n){case 0:if(i){r.n=1;break}return r.a(2,{success:!1,message:"Pro version is required."});case 1:return f(!0),r.p=2,a="".concat(t,"file-manager-advanced/v1/integrations/").concat(e,"/install-library"),r.n=3,fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":n}});case 3:return s=r.v,r.n=4,s.json();case 4:if(l=r.v,!s.ok||!l.success){r.n=5;break}return u(!0),r.a(2,{success:!0,message:l.message||"Library installed successfully!"});case 5:return d=l.message||(null===(c=l.data)||void 0===c?void 0:c.message)||"Failed to install library",r.a(2,{success:!1,message:d});case 6:r.n=8;break;case 7:return r.p=7,p=r.v,console.error("Error installing ".concat(e," library:"),p),r.a(2,{success:!1,message:"Failed to install ".concat(e," library")});case 8:return r.p=8,f(!1),r.f(8);case 9:return r.a(2)}},r,null,[[2,7,8,9]])}),function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function s(e){a(i,n,o,s,l,"next",e)}function l(e){a(i,n,o,s,l,"throw",e)}s(void 0)})});return function(){return s.apply(this,arguments)}}();return{libraryInstalled:c,setLibraryInstalled:u,installing:p,installLibrary:g}}n(961);var u={label:{display:"block",marginBottom:"8px",fontSize:"14px",fontWeight:600,color:"#0f172a"},input:{width:"100%",padding:"10px 12px",fontSize:"14px",border:"1px solid #ddd",borderRadius:"4px",boxSizing:"border-box"},description:{margin:"8px 0 0 0",fontSize:"13px",color:"#666",lineHeight:"1.5"},link:{color:"#3F6972",textDecoration:"underline",fontWeight:600},emphasis:{fontWeight:600,color:"#0f172a"},warningBox:{marginBottom:"20px",padding:"15px",background:"#fff3cd",border:"1px solid #ffc107",borderRadius:"4px"},warningText:{margin:"0 0 10px 0",color:"#856404",fontWeight:600},installButton:{padding:"10px 20px",background:"#3F6972",color:"#fff",border:"none",borderRadius:"4px",fontSize:"14px",fontWeight:600,cursor:"pointer"}},d=n(4848);function p(e){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p(e)}function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function h(e,t,n){return(t=function(e){var t=function(e){if("object"!=p(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=p(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==p(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return m(c,"_invoke",function(n,r,o){var i,s,l,c=0,u=o||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return i=t,s=0,l=e,p.n=n,a}};function f(n,r){for(s=n,l=r,t=0;!d&&c&&!o&&t<u.length;t++){var o,i=u[t],f=p.p,g=i[2];n>3?(o=g===r)&&(l=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=f&&((o=n<2&&f<i[1])?(s=0,p.v=r,p.n=i[1]):f<g&&(o=n<3||i[0]>r||r>g)&&(i[4]=n,i[5]=r,p.n=g,s=0))}if(o||n>1)return a;throw d=!0,r}return function(o,u,g){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,g),s=u,l=g;(t=s<2?e:l)||!d;){i||(s?s<3?(s>1&&(p.n=-1),f(s,l)):p.n=l:p.v=l);try{if(c=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(d=p.n<0)?l:n.call(r,p))!==a)break}catch(t){i=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,o,i),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(m(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,m(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,m(d,"constructor",c),m(c,"constructor",l),l.displayName="GeneratorFunction",m(c,o,"GeneratorFunction"),m(d),m(d,o,"Generator"),m(d,r,function(){return this}),m(d,"toString",function(){return"[object Generator]"}),(y=function(){return{w:i,m:p}})()}function m(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}m=function(e,t,n,r){function i(t,n){m(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},m(e,t,n,r)}function b(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function v(e){var t,n,o=e.settings,i=e.hasPro,a=e.root,s=e.nonce,l=e.setMessage,p=e.onLibraryInstalled,f=(t=(0,r.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,n)||function(e,t){if(e){if("string"==typeof e)return x(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?x(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),h=f[0],m=f[1],v=c("amazon-s3",a,s,i),j=v.libraryInstalled,w=v.setLibraryInstalled,k=v.installing,S=v.installLibrary,_=function(){var e,t=(e=y().m(function e(){var t;return y().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,S();case 1:(t=e.v).success?(w(!0),l({type:"success",text:t.message}),setTimeout(function(){return l(null)},3e3),p&&p()):(l({type:"error",text:t.message}),setTimeout(function(){return l(null)},5e3));case 2:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){b(i,r,o,a,s,"next",e)}function s(e){b(i,r,o,a,s,"throw",e)}a(void 0)})});return function(){return t.apply(this,arguments)}}();r.useEffect(function(){void 0!==o.library_installed&&w(o.library_installed)},[o.library_installed,w]);var O=!i||!j;return(0,d.jsxs)(d.Fragment,{children:[!j&&(0,d.jsxs)("div",{style:u.warningBox,children:[(0,d.jsx)("p",{style:u.warningText,children:"Amazon S3 library is not installed"}),(0,d.jsx)("button",{onClick:_,disabled:!i||k,style:g(g({},u.installButton),{},{background:k?"#ccc":"#3F6972",cursor:!i||k?"not-allowed":"pointer"}),children:k?"Installing Library...":"Install Amazon S3 Library"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"title",style:u.label,children:"Alias"}),(0,d.jsx)("input",{type:"text",id:"title",name:"title",defaultValue:o.title||"Amazon S3",disabled:O,style:g(g({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter a title which will be displayed on File Manager"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"app_key",style:u.label,children:["App Key ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsx)("input",{type:"text",id:"app_key",name:"app_key",defaultValue:o.app_key||"",disabled:O,style:g(g({},u.input),{},{maxWidth:"500px"})}),(0,d.jsxs)("p",{style:u.description,children:["Enter your Amazon S3 (AWS) App key."," ",(0,d.jsx)("a",{href:"https://aws.amazon.com/s3/",target:"_blank",rel:"noopener noreferrer",style:u.link,children:"Learn how to get your credentials"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"app_secret",style:u.label,children:["App Secret ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsxs)("div",{style:{position:"relative",maxWidth:"500px"},children:[(0,d.jsx)("input",{type:h?"text":"password",id:"app_secret",name:"app_secret",defaultValue:o.app_secret||"",disabled:O,style:u.input}),(0,d.jsx)("button",{type:"button",onClick:function(){return m(!h)},disabled:O,style:{position:"absolute",right:"10px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:O?"not-allowed":"pointer",padding:"5px",display:"flex",alignItems:"center",justifyContent:"center",color:"#666",opacity:O?.5:1},title:h?"Hide App Secret":"Show App Secret",children:h?(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),(0,d.jsx)("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})})]}),(0,d.jsxs)("p",{style:u.description,children:["Enter your Amazon S3 (AWS) App secret."," ",(0,d.jsx)("a",{href:"https://aws.amazon.com/s3/",target:"_blank",rel:"noopener noreferrer",style:u.link,children:"Learn how to get your credentials"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"region",style:u.label,children:["Region ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsx)("input",{type:"text",id:"region",name:"region",defaultValue:o.region||"",placeholder:"e.g. us-east-1",disabled:O,style:g(g({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter the AWS region where your bucket is located (e.g. us-east-1)"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"bucket",style:u.label,children:["Bucket ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsx)("input",{type:"text",id:"bucket",name:"bucket",defaultValue:o.bucket||"",disabled:O,style:g(g({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter the name of your Amazon S3 bucket"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{style:u.label,children:"User Role Access"}),(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:["editor","author","contributor","subscriber"].map(function(e){return(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:O?"not-allowed":"pointer"},children:[(0,d.jsx)("input",{type:"checkbox",name:"user_role_access",value:e,defaultChecked:o.user_role_access&&o.user_role_access.includes(e),disabled:O,style:{margin:0}}),(0,d.jsx)("span",{style:{textTransform:"capitalize",fontSize:"14px"},children:e})]},e)})}),(0,d.jsx)("p",{style:u.description,children:"Select the user roles allowed to access the AWS-connected file manager"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"private_folder_access",style:u.label,children:"Private Folder Access"}),(0,d.jsx)("input",{type:"text",id:"private_folder_access",name:"private_folder_access",defaultValue:o.private_folder_access||"",placeholder:"e.g. awsfolder",disabled:O,style:g(g({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter a folder name to restrict access to that folder only. Leave blank to use the root directory (e.g. awsfolder)"})]})]})}function j(e){return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},j(e)}function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function k(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w(Object(n),!0).forEach(function(t){S(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function S(e,t,n){return(t=function(e){var t=function(e){if("object"!=j(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=j(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==j(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return O(c,"_invoke",function(n,r,o){var i,s,l,c=0,u=o||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return i=t,s=0,l=e,p.n=n,a}};function f(n,r){for(s=n,l=r,t=0;!d&&c&&!o&&t<u.length;t++){var o,i=u[t],f=p.p,g=i[2];n>3?(o=g===r)&&(l=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=f&&((o=n<2&&f<i[1])?(s=0,p.v=r,p.n=i[1]):f<g&&(o=n<3||i[0]>r||r>g)&&(i[4]=n,i[5]=r,p.n=g,s=0))}if(o||n>1)return a;throw d=!0,r}return function(o,u,g){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,g),s=u,l=g;(t=s<2?e:l)||!d;){i||(s?s<3?(s>1&&(p.n=-1),f(s,l)):p.n=l:p.v=l);try{if(c=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(d=p.n<0)?l:n.call(r,p))!==a)break}catch(t){i=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,o,i),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(O(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,O(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,O(d,"constructor",c),O(c,"constructor",l),l.displayName="GeneratorFunction",O(c,o,"GeneratorFunction"),O(d),O(d,o,"Generator"),O(d,r,function(){return this}),O(d,"toString",function(){return"[object Generator]"}),(_=function(){return{w:i,m:p}})()}function O(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}O=function(e,t,n,r){function i(t,n){O(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},O(e,t,n,r)}function T(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function P(e){var t=e.settings,n=e.hasPro,o=e.root,i=e.nonce,a=e.setMessage,s=(e.selectedAuthKeyFile,e.setSelectedAuthKeyFile),l=e.onLibraryInstalled,p=c("google-cloud-storage",o,i,n),f=p.libraryInstalled,g=p.setLibraryInstalled,h=p.installing,y=p.installLibrary,m=function(){var e,t=(e=_().m(function e(){var t;return _().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,y();case 1:(t=e.v).success?(g(!0),a({type:"success",text:t.message}),setTimeout(function(){return a(null)},3e3),l&&l()):(a({type:"error",text:t.message}),setTimeout(function(){return a(null)},5e3));case 2:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){T(i,r,o,a,s,"next",e)}function s(e){T(i,r,o,a,s,"throw",e)}a(void 0)})});return function(){return t.apply(this,arguments)}}();r.useEffect(function(){void 0!==t.library_installed&&g(t.library_installed)},[t.library_installed,g]);var b=!n||!f;return(0,d.jsxs)(d.Fragment,{children:[!f&&(0,d.jsxs)("div",{style:u.warningBox,children:[(0,d.jsx)("p",{style:k(k({},u.warningText),{},{marginBottom:"12px"}),children:"Google Cloud library is not installed. Please install the library first to configure authentication settings."}),(0,d.jsx)("button",{type:"button",onClick:m,disabled:!n||h,style:k(k({},u.installButton),{},{background:h?"#ccc":"#3F6972",cursor:!n||h?"not-allowed":"pointer"}),children:h?"Installing Library...":"Install Google Cloud Library"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"title",style:u.label,children:"Alias"}),(0,d.jsx)("input",{type:"text",id:"title",name:"title",defaultValue:t.title||"Google Cloud Storage",disabled:b,style:k(k({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter a title which will be displayed on File Manager"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"auth_key",style:u.label,children:["Authentication Key File ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),t.auth_key&&""!==t.auth_key.trim()&&(0,d.jsxs)("div",{style:{marginBottom:"12px",padding:"10px",background:"#f0f0f0",borderRadius:"4px",maxWidth:"500px"},children:[(0,d.jsxs)("p",{style:{margin:0,fontSize:"14px",fontWeight:600,color:"#333"},children:["Current File: ",t.auth_key.split("/").pop()]}),(0,d.jsx)("p",{style:{margin:"4px 0 0 0",fontSize:"12px",color:"#666"},children:"Upload a new file to replace the current one"})]}),(0,d.jsx)("input",{type:"file",id:"auth_key",name:"auth_key",accept:".json",disabled:b,style:k(k({},u.input),{},{maxWidth:"500px"}),onChange:function(e){var t,n=null===(t=e.target.files)||void 0===t?void 0:t[0];s(n||null)}}),(0,d.jsx)("p",{style:u.description,children:"Upload your Google Cloud service account key file (.json format)"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"bucket",style:u.label,children:["Bucket ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsx)("input",{type:"text",id:"bucket",name:"bucket",defaultValue:t.bucket||"",disabled:b,style:k(k({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter the name of your Google Cloud Storage bucket"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{style:u.label,children:"User Role Access"}),(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:["editor","author","contributor","subscriber"].map(function(e){return(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:b?"not-allowed":"pointer"},children:[(0,d.jsx)("input",{type:"checkbox",name:"user_role_access",value:e,defaultChecked:t.user_role_access&&t.user_role_access.includes(e),disabled:b,style:{margin:0}}),(0,d.jsx)("span",{style:{textTransform:"capitalize",fontSize:"14px"},children:e})]},e)})}),(0,d.jsx)("p",{style:u.description,children:"Select the user roles allowed to access the Google Cloud file manager"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"private_folder_access",style:u.label,children:"Private Folder Access"}),(0,d.jsx)("input",{type:"text",id:"private_folder_access",name:"private_folder_access",defaultValue:t.private_folder_access||"",disabled:b,style:k(k({},u.input),{},{maxWidth:"500px"}),placeholder:"e.g. Documents"}),(0,d.jsx)("p",{style:u.description,children:"Enter a subfolder path within your bucket. Leave blank to use the root directory"}),(0,d.jsxs)("p",{style:k(k({},u.description),{},{color:"red",marginTop:"4px"}),children:[(0,d.jsx)("strong",{children:"Note: "}),"Folder paths and user role values are case-sensitive"]})]})]})}function C(e){return C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},C(e)}function I(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function A(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?I(Object(n),!0).forEach(function(t){E(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):I(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function E(e,t,n){return(t=function(e){var t=function(e){if("object"!=C(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=C(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==C(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function F(e){var t=e.serviceName,n=e.isConnected,r=e.canConnect,o=e.hasPro,i=void 0===o||o,a=e.onConnect,s=e.onDisconnect,l=e.brandColor,c=void 0===l?"#3F6972":l,p=e.credentialsHint,f=void 0===p?"Please enter your credentials, then save changes before connecting.":p,g=e.showCredentialsHint,h=void 0===g||g;if(n)return(0,d.jsx)("div",{style:{marginTop:"20px"},children:(0,d.jsxs)("div",{style:{padding:"15px",background:"#d4edda",border:"1px solid #c3e6cb",borderRadius:"4px",maxWidth:"500px"},children:[(0,d.jsxs)("p",{style:{margin:"0 0 10px 0",color:"#155724",fontWeight:600},children:["✓ Connected to ",t]}),(0,d.jsxs)("button",{type:"button",onClick:s,style:{padding:"8px 16px",background:"#dc3545",color:"#fff",border:"none",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer"},children:["Disconnect ",t]})]})});var y=i&&r;return(0,d.jsxs)("div",{style:{marginTop:"20px"},children:[(0,d.jsxs)("button",{type:"button",onClick:a,disabled:!y,style:A(A({},u.installButton),{},{background:y?c:"#ccc",cursor:y?"pointer":"not-allowed"}),children:["Connect ",t]}),h&&!r&&(0,d.jsx)("p",{style:A(A({},u.description),{},{marginTop:"10px",color:"#64748b",maxWidth:"500px"}),children:f})]})}function D(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return R(c,"_invoke",function(n,r,o){var i,s,l,c=0,u=o||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return i=t,s=0,l=e,p.n=n,a}};function f(n,r){for(s=n,l=r,t=0;!d&&c&&!o&&t<u.length;t++){var o,i=u[t],f=p.p,g=i[2];n>3?(o=g===r)&&(l=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=f&&((o=n<2&&f<i[1])?(s=0,p.v=r,p.n=i[1]):f<g&&(o=n<3||i[0]>r||r>g)&&(i[4]=n,i[5]=r,p.n=g,s=0))}if(o||n>1)return a;throw d=!0,r}return function(o,u,g){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,g),s=u,l=g;(t=s<2?e:l)||!d;){i||(s?s<3?(s>1&&(p.n=-1),f(s,l)):p.n=l:p.v=l);try{if(c=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(d=p.n<0)?l:n.call(r,p))!==a)break}catch(t){i=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,o,i),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(R(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,R(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,R(d,"constructor",c),R(c,"constructor",l),l.displayName="GeneratorFunction",R(c,o,"GeneratorFunction"),R(d),R(d,o,"Generator"),R(d,r,function(){return this}),R(d,"toString",function(){return"[object Generator]"}),(D=function(){return{w:i,m:p}})()}function R(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}R=function(e,t,n,r){function i(t,n){R(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},R(e,t,n,r)}function W(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function M(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){W(i,r,o,a,s,"next",e)}function s(e){W(i,r,o,a,s,"throw",e)}a(void 0)})}}function G(e){return z.apply(this,arguments)}function z(){return(z=M(D().m(function e(t){var n,r,o;return D().w(function(e){for(;;)switch(e.p=e.n){case 0:if(n=String(t||"")){e.n=1;break}return e.a(2,!1);case 1:if(e.p=1,!navigator.clipboard||!window.isSecureContext){e.n=3;break}return e.n=2,navigator.clipboard.writeText(n);case 2:return e.a(2,!0);case 3:e.n=5;break;case 4:e.p=4,e.v;case 5:return e.p=5,(r=document.createElement("textarea")).value=n,r.setAttribute("readonly",""),r.style.position="fixed",r.style.left="-9999px",r.style.opacity="0",document.body.appendChild(r),r.focus(),r.select(),r.setSelectionRange(0,n.length),o=document.execCommand("copy"),document.body.removeChild(r),e.a(2,o);case 6:return e.p=6,e.v,e.a(2,!1)}},e,null,[[5,6],[1,4]])}))).apply(this,arguments)}function B(e,t){return N.apply(this,arguments)}function N(){return N=M(D().m(function e(t,n){var r,o,i=arguments;return D().w(function(e){for(;;)switch(e.n){case 0:return r=i.length>2&&void 0!==i[2]?i[2]:"Copied to clipboard!",e.n=1,G(t);case 1:if(o=e.v,n){e.n=2;break}return e.a(2,o);case 2:return o?(n({type:"success",text:r}),setTimeout(function(){return n(null)},2e3)):(n({type:"error",text:"Failed to copy to clipboard"}),setTimeout(function(){return n(null)},3e3)),e.a(2,o)}},e)})),N.apply(this,arguments)}function U(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return L(c,"_invoke",function(n,r,o){var i,s,l,c=0,u=o||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return i=t,s=0,l=e,p.n=n,a}};function f(n,r){for(s=n,l=r,t=0;!d&&c&&!o&&t<u.length;t++){var o,i=u[t],f=p.p,g=i[2];n>3?(o=g===r)&&(l=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=f&&((o=n<2&&f<i[1])?(s=0,p.v=r,p.n=i[1]):f<g&&(o=n<3||i[0]>r||r>g)&&(i[4]=n,i[5]=r,p.n=g,s=0))}if(o||n>1)return a;throw d=!0,r}return function(o,u,g){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,g),s=u,l=g;(t=s<2?e:l)||!d;){i||(s?s<3?(s>1&&(p.n=-1),f(s,l)):p.n=l:p.v=l);try{if(c=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(d=p.n<0)?l:n.call(r,p))!==a)break}catch(t){i=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,o,i),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(L(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,L(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,L(d,"constructor",c),L(c,"constructor",l),l.displayName="GeneratorFunction",L(c,o,"GeneratorFunction"),L(d),L(d,o,"Generator"),L(d,r,function(){return this}),L(d,"toString",function(){return"[object Generator]"}),(U=function(){return{w:i,m:p}})()}function L(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}L=function(e,t,n,r){function i(t,n){L(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},L(e,t,n,r)}function H(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}var V=function(e){return{background:"transparent",border:"1px solid #ddd",borderRadius:"4px",padding:"10px 12px",cursor:e?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"center",opacity:e?.5:1}};function K(e){var t=e.text,n=e.disabled,r=void 0!==n&&n,o=e.setMessage,i=e.successMessage,a=void 0===i?"Copied to clipboard!":i,s=e.title,l=void 0===s?"Copy to clipboard":s,c=function(){var e,n=(e=U().m(function e(n){return U().w(function(e){for(;;)switch(e.n){case 0:if(n.preventDefault(),n.stopPropagation(),!r){e.n=1;break}return e.a(2);case 1:return e.n=2,B(t,o,a);case 2:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){H(i,r,o,a,s,"next",e)}function s(e){H(i,r,o,a,s,"throw",e)}a(void 0)})});return function(e){return n.apply(this,arguments)}}();return(0,d.jsx)("button",{type:"button",onClick:c,disabled:r,style:V(r),title:l,"aria-label":l,children:(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,d.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",stroke:"#666"}),(0,d.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1",stroke:"#666"})]})})}var X=["editor","author","contributor","subscriber"];function Y(e){var t=e.settings,n=void 0===t?{}:t,r=e.disabled,o=void 0!==r&&r,i=e.description,a=Array.isArray(n.user_role_access)?n.user_role_access:[];return(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{style:u.label,children:"User Role Access"}),(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:X.map(function(e){return(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:o?"not-allowed":"pointer"},children:[(0,d.jsx)("input",{type:"checkbox",name:"user_role_access",value:e,defaultChecked:a.includes(e),disabled:o,style:{margin:0}}),(0,d.jsx)("span",{style:{textTransform:"capitalize",fontSize:"14px"},children:e})]},e)})}),i?(0,d.jsx)("p",{style:u.description,children:i}):null]})}function $(e){return $="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$(e)}function q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function J(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?q(Object(n),!0).forEach(function(t){Z(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Z(e,t,n){return(t=function(e){var t=function(e){if("object"!=$(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=$(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==$(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Q(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return ee(c,"_invoke",function(n,r,o){var i,s,l,c=0,u=o||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return i=t,s=0,l=e,p.n=n,a}};function f(n,r){for(s=n,l=r,t=0;!d&&c&&!o&&t<u.length;t++){var o,i=u[t],f=p.p,g=i[2];n>3?(o=g===r)&&(l=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=f&&((o=n<2&&f<i[1])?(s=0,p.v=r,p.n=i[1]):f<g&&(o=n<3||i[0]>r||r>g)&&(i[4]=n,i[5]=r,p.n=g,s=0))}if(o||n>1)return a;throw d=!0,r}return function(o,u,g){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,g),s=u,l=g;(t=s<2?e:l)||!d;){i||(s?s<3?(s>1&&(p.n=-1),f(s,l)):p.n=l:p.v=l);try{if(c=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(d=p.n<0)?l:n.call(r,p))!==a)break}catch(t){i=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,o,i),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(ee(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,ee(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,ee(d,"constructor",c),ee(c,"constructor",l),l.displayName="GeneratorFunction",ee(c,o,"GeneratorFunction"),ee(d),ee(d,o,"Generator"),ee(d,r,function(){return this}),ee(d,"toString",function(){return"[object Generator]"}),(Q=function(){return{w:i,m:p}})()}function ee(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}ee=function(e,t,n,r){function i(t,n){ee(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},ee(e,t,n,r)}function te(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function ne(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function re(e){var t,n,o=e.settings,i=e.hasPro,a=e.root,s=e.nonce,l=e.setMessage,p=e.isConnected,f=e.setShowDisconnectModal,g=e.setDisconnectIntegration,h=c("dropbox",a,s,i),y=h.libraryInstalled,m=h.setLibraryInstalled,b=h.installing,x=h.installLibrary,v=(t=(0,r.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,n)||function(e,t){if(e){if("string"==typeof e)return ne(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ne(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),j=v[0],w=v[1],k=function(){var e,t=(e=Q().m(function e(){var t;return Q().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,x();case 1:(t=e.v).success?(l({type:"success",text:t.message}),setTimeout(function(){return l(null)},3e3)):(l({type:"error",text:t.message}),setTimeout(function(){return l(null)},5e3));case 2:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){te(i,r,o,a,s,"next",e)}function s(e){te(i,r,o,a,s,"throw",e)}a(void 0)})});return function(){return t.apply(this,arguments)}}();r.useEffect(function(){void 0!==o.library_installed&&m(o.library_installed)},[o.library_installed,m]);var S=o.redirect_uri||"",_=!i||!y,O=!!(o.app_key&&o.app_secret&&S);return(0,d.jsxs)(d.Fragment,{children:[!y&&(0,d.jsxs)("div",{style:u.warningBox,children:[(0,d.jsx)("p",{style:u.warningText,children:"Dropbox library is not installed. Please install the library first to configure authentication settings."}),(0,d.jsx)("button",{type:"button",onClick:k,disabled:!i||b,style:J(J({},u.installButton),{},{background:b?"#ccc":"#3F6972",cursor:!i||b?"not-allowed":"pointer"}),children:b?"Installing Library...":"Install Dropbox Library"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"title",style:u.label,children:"Alias"}),(0,d.jsx)("input",{type:"text",id:"title",name:"title",defaultValue:o.title||"Dropbox",disabled:!i,style:J(J({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter a title which will be displayed on File Manager"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"app_key",style:u.label,children:"App Key"}),(0,d.jsx)("input",{type:"text",id:"app_key",name:"app_key",defaultValue:o.app_key||"",disabled:!i,style:J(J({},u.input),{},{maxWidth:"500px"})}),(0,d.jsxs)("p",{style:u.description,children:["Enter your Dropbox App key, you will get your app key from"," ",(0,d.jsx)("a",{href:"https://www.dropbox.com/developers/apps",target:"_blank",rel:"noopener noreferrer",style:u.link,children:"Dropbox App Console"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"app_secret",style:u.label,children:"App Secret"}),(0,d.jsxs)("div",{style:{position:"relative",maxWidth:"500px"},children:[(0,d.jsx)("input",{type:j?"text":"password",id:"app_secret",name:"app_secret",defaultValue:o.app_secret||"",disabled:!i,style:u.input}),(0,d.jsx)("button",{type:"button",onClick:function(){return w(!j)},style:{position:"absolute",right:"10px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",padding:"5px",display:"flex",alignItems:"center",justifyContent:"center",color:"#666"},title:j?"Hide App Secret":"Show App Secret",children:j?(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),(0,d.jsx)("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})})]}),(0,d.jsxs)("p",{style:u.description,children:["Enter your Dropbox App secret, you will get your app secret from"," ",(0,d.jsx)("a",{href:"https://www.dropbox.com/developers/apps",target:"_blank",rel:"noopener noreferrer",style:u.link,children:"Dropbox App Console"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"redirect_uri",style:u.label,children:"Redirect URI"}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",maxWidth:"500px"},children:[(0,d.jsx)("input",{type:"text",id:"redirect_uri",name:"redirect_uri",value:S,readOnly:!0,disabled:!i,style:J(J({},u.input),{},{background:"#f5f5f5"})}),(0,d.jsx)(K,{text:S,disabled:!i,setMessage:l,successMessage:"Redirect URI copied to clipboard!"})]}),(0,d.jsxs)("p",{style:u.description,children:["Copy this URL and paste it in your"," ",(0,d.jsx)("strong",{style:u.emphasis,children:"Dropbox App Console"})," under"," ",(0,d.jsx)("strong",{style:u.emphasis,children:"Redirect URIs"})]})]}),(0,d.jsx)(Y,{settings:o,disabled:_,description:"Select the user roles allowed to access the Dropbox file manager"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"private_folder_access",style:u.label,children:"Private Folder Access"}),(0,d.jsx)("input",{type:"text",id:"private_folder_access",name:"private_folder_access",defaultValue:o.private_folder_access||"",disabled:_,style:J(J({},u.input),{},{maxWidth:"500px"}),placeholder:"e.g. Documents"}),(0,d.jsx)("p",{style:u.description,children:"Enter a folder name/path to restrict access to that folder only. Leave blank to use the root directory."})]}),y&&(0,d.jsx)(F,{serviceName:"Dropbox",isConnected:p,canConnect:O,hasPro:i,brandColor:"#0061FF",credentialsHint:"Please enter your App Key and App Secret, then save changes before connecting.",onConnect:function(){if(O&&i){var e=window.location.hash||"#/extension/dropbox";sessionStorage.setItem("afm-dropbox-redirect-to",e);var t="https://www.dropbox.com/oauth2/authorize?client_id=".concat(encodeURIComponent(o.app_key),"&response_type=code&token_access_type=offline&redirect_uri=").concat(encodeURIComponent(S),"&state=").concat(encodeURIComponent(e));window.location.href=t}else!S&&l&&(l({type:"error",text:"Redirect URI is missing. Please reload the page and try again."}),setTimeout(function(){return l(null)},4e3))},onDisconnect:function(e){e.preventDefault(),e.stopPropagation(),g&&f&&(g("dropbox"),f(!0))}})]})}function oe(e){return oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},oe(e)}function ie(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ae(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ie(Object(n),!0).forEach(function(t){se(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ie(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function se(e,t,n){return(t=function(e){var t=function(e){if("object"!=oe(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=oe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==oe(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function le(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ce(e){var t,n,o=e.settings,i=e.hasPro,a=e.isConnected,s=e.onConnect,l=e.setMessage,c=e.setShowDisconnectModal,p=e.setDisconnectIntegration,f=(t=(0,r.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,n)||function(e,t){if(e){if("string"==typeof e)return le(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?le(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),g=f[0],h=f[1],y=o.redirect_uri||"",m=!!(o.app_id&&o.app_secret&&y);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"title",style:u.label,children:"Alias"}),(0,d.jsx)("input",{type:"text",id:"title",name:"title",defaultValue:o.title||"OneDrive",disabled:!i,style:ae(ae({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter a title which will be displayed on File Manager"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"app_id",style:u.label,children:"Application (client) ID"}),(0,d.jsx)("input",{type:"text",id:"app_id",name:"app_id",defaultValue:o.app_id||"",disabled:!i,style:ae(ae({},u.input),{},{maxWidth:"500px"})}),(0,d.jsxs)("p",{style:u.description,children:["Enter your OneDrive Application (client) ID from your"," ",(0,d.jsx)("a",{href:"https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade",target:"_blank",rel:"noopener noreferrer",style:u.link,children:"Azure AD app registration."})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"app_secret",style:u.label,children:"Client secret"}),(0,d.jsxs)("div",{style:{position:"relative",maxWidth:"500px"},children:[(0,d.jsx)("input",{type:g?"text":"password",id:"app_secret",name:"app_secret",defaultValue:o.app_secret||"",disabled:!i,style:ae(ae({},u.input),{},{paddingRight:"40px"})}),(0,d.jsx)("button",{type:"button",onClick:function(){return h(!g)},disabled:!i,style:{position:"absolute",right:"10px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:i?"pointer":"not-allowed",padding:"5px",display:"flex",alignItems:"center",justifyContent:"center",color:"#666",zIndex:10,opacity:i?1:.5},title:g?"Hide App Secret":"Show App Secret",children:g?(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),(0,d.jsx)("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})})]}),(0,d.jsxs)("p",{style:u.description,children:["Enter your OneDrive Client secret from your"," ",(0,d.jsx)("a",{href:"https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade",target:"_blank",rel:"noopener noreferrer",style:u.link,children:"Azure AD app registration."})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"redirect_uri",style:u.label,children:"Redirect URI"}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",maxWidth:"500px"},children:[(0,d.jsx)("input",{type:"text",id:"redirect_uri",value:y,readOnly:!0,disabled:!i,style:ae(ae({},u.input),{},{background:"#f5f5f5",cursor:"not-allowed"})}),(0,d.jsx)(K,{text:y,disabled:!i,setMessage:l,successMessage:"Redirect URI copied to clipboard!"})]}),(0,d.jsxs)("p",{style:u.description,children:["Copy this exact URL into"," ",(0,d.jsx)("strong",{style:u.emphasis,children:"Azure AD app registration → Authentication → Redirect URIs (Web)"}),". Do not add ?page= or other query parameters."]})]}),(0,d.jsx)(Y,{settings:o,disabled:!i,description:"Select the user roles allowed to access the OneDrive file manager"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"private_folder_access",style:u.label,children:"Private Folder Access"}),(0,d.jsx)("input",{type:"text",id:"private_folder_access",name:"private_folder_access",defaultValue:o.private_folder_access||"",disabled:!i,style:ae(ae({},u.input),{},{maxWidth:"500px"}),placeholder:"e.g. Documents"}),(0,d.jsx)("p",{style:u.description,children:"Enter a folder name/path to restrict access to that folder only. Leave blank to use the root directory."})]}),(0,d.jsx)(F,{serviceName:"OneDrive",isConnected:a,canConnect:m,hasPro:i,brandColor:"#0078d4",credentialsHint:"Please enter your Application (client) ID and Client secret, then save changes before connecting.",onConnect:s,onDisconnect:function(e){e.preventDefault(),e.stopPropagation(),p&&c&&(p("onedrive"),c(!0))}})]})}function ue(e){return ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ue(e)}function de(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function pe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?de(Object(n),!0).forEach(function(t){fe(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):de(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function fe(e,t,n){return(t=function(e){var t=function(e){if("object"!=ue(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ue(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ue(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ge(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function he(e){var t,n,o=e.settings,i=e.hasPro,a=e.isConnected,s=e.setShowDisconnectModal,l=e.setDisconnectIntegration,c=e.setMessage,p=(t=(0,r.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,n)||function(e,t){if(e){if("string"==typeof e)return ge(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ge(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),f=p[0],g=p[1],h=o.redirect_uri||"",y=!!(o.app_key&&o.app_secret&&h);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"title",style:u.label,children:"Alias"}),(0,d.jsx)("input",{type:"text",id:"title",name:"title",defaultValue:o.title||"Google Drive",disabled:!i,style:pe(pe({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter a title which will be displayed on File Manager"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"app_key",style:u.label,children:"App Key"}),(0,d.jsx)("input",{type:"text",id:"app_key",name:"app_key",defaultValue:o.app_key||"",disabled:!i,style:pe(pe({},u.input),{},{maxWidth:"500px"})}),(0,d.jsxs)("p",{style:u.description,children:["Enter your Google Drive App key, you will get your app key from"," ",(0,d.jsx)("a",{href:"https://console.cloud.google.com/apis/credentials",target:"_blank",rel:"noopener noreferrer",style:u.link,children:"Google Drive App Console"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"app_secret",style:u.label,children:"App Secret"}),(0,d.jsxs)("div",{style:{position:"relative",maxWidth:"500px"},children:[(0,d.jsx)("input",{type:f?"text":"password",id:"app_secret",name:"app_secret",defaultValue:o.app_secret||"",disabled:!i,style:u.input}),(0,d.jsx)("button",{type:"button",onClick:function(){return g(!f)},style:{position:"absolute",right:"10px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:"pointer",padding:"5px",display:"flex",alignItems:"center",justifyContent:"center",color:"#666"},title:f?"Hide App Secret":"Show App Secret",children:f?(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),(0,d.jsx)("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})})]}),(0,d.jsxs)("p",{style:u.description,children:["Enter your Google Drive App secret, you will get your app secret from"," ",(0,d.jsx)("a",{href:"https://console.cloud.google.com/apis/credentials",target:"_blank",rel:"noopener noreferrer",style:u.link,children:"Google Drive App Console"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"javascript_origin",style:u.label,children:"Javascript Origin"}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",maxWidth:"500px"},children:[(0,d.jsx)("input",{type:"text",id:"javascript_origin",name:"javascript_origin",value:window.location.origin,readOnly:!0,disabled:!i,style:pe(pe({},u.input),{},{background:"#f5f5f5",cursor:"not-allowed",maxWidth:"500px"})}),(0,d.jsx)(K,{text:window.location.origin,disabled:!i,setMessage:c,successMessage:"JavaScript Origin copied to clipboard!"})]}),(0,d.jsxs)("p",{style:u.description,children:["Copy this URL and paste it in your"," ",(0,d.jsx)("strong",{style:u.emphasis,children:"Google Drive App Console"})," under"," ",(0,d.jsx)("strong",{style:u.emphasis,children:"JavaScript Origins"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"redirect_uri",style:u.label,children:"Redirect URL"}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",maxWidth:"500px"},children:[(0,d.jsx)("input",{type:"text",id:"redirect_uri",name:"redirect_uri",value:h,readOnly:!0,disabled:!i,style:pe(pe({},u.input),{},{background:"#f5f5f5",cursor:"not-allowed",maxWidth:"500px"})}),(0,d.jsx)(K,{text:h,disabled:!i,setMessage:c,successMessage:"Redirect URL copied to clipboard!"})]}),(0,d.jsxs)("p",{style:u.description,children:["Copy this URL and paste it in your"," ",(0,d.jsx)("strong",{style:u.emphasis,children:"Google Drive App Console"})," under"," ",(0,d.jsx)("strong",{style:u.emphasis,children:"Redirect URIs"})]})]}),(0,d.jsx)(Y,{settings:o,disabled:!i,description:"Select the user roles allowed to access the Google Drive file manager"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"private_folder_access",style:u.label,children:"Private Folder Access"}),(0,d.jsx)("input",{type:"text",id:"private_folder_access",name:"private_folder_access",defaultValue:o.private_folder_access||"",disabled:!i,style:pe(pe({},u.input),{},{maxWidth:"500px"}),placeholder:"e.g. Documents"}),(0,d.jsx)("p",{style:u.description,children:"Enter a folder path to restrict access to that folder only. Leave blank to use the root directory."})]}),(0,d.jsx)(F,{serviceName:"Google Drive",isConnected:a,canConnect:y,hasPro:i,brandColor:"#4285F4",credentialsHint:"Please enter your App Key and App Secret, then save changes before connecting.",onConnect:function(){if(y&&i){var e=window.location.hash||"#/extension/google-drive";window.location.href="https://accounts.google.com/o/oauth2/v2/auth?client_id=".concat(encodeURIComponent(o.app_key),"&response_type=code&redirect_uri=").concat(encodeURIComponent(h),"&scope=https://www.googleapis.com/auth/drive&access_type=offline&prompt=consent&state=").concat(encodeURIComponent(e))}else!h&&c&&(c({type:"error",text:"Redirect URI is missing. Please reload the page and try again."}),setTimeout(function(){return c(null)},4e3))},onDisconnect:function(e){e.preventDefault(),e.stopPropagation(),l&&s&&(l("google-drive"),s(!0))}})]})}function ye(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function me(e){var t,n,o=e.isOpen,i=e.onClose,a=e.onConfirm,s=e.title,l=e.message,c=e.confirmText,u=void 0===c?"Confirm":c,p=e.cancelText,f=void 0===p?"Cancel":p,g=e.type,h=void 0===g?"primary":g,y=(t=(0,r.useState)("undefined"!=typeof window?window.innerWidth:1024),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,n)||function(e,t){if(e){if("string"==typeof e)return ye(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ye(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),m=y[0],b=y[1];if((0,r.useEffect)(function(){return document.body.style.overflow=o?"hidden":"",function(){document.body.style.overflow=""}},[o]),(0,r.useEffect)(function(){var e=function(){b(window.innerWidth)};if(o)return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}},[o]),(0,r.useEffect)(function(){var e=function(e){"Escape"===e.key&&o&&i()};return o&&document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}},[o,i]),!o)return null;var x={primary:"❓",danger:"⚠️",warning:"⚠️",info:"ℹ️"};return(0,d.jsxs)("div",{className:"afmp-confirm-modal",onClick:function(e){e.target===e.currentTarget&&i()},style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",background:"rgba(0,0,0,0.5)",zIndex:999999999,display:"flex",alignItems:"center",justifyContent:"center",padding:m<=1024?"15px":"20px",overflowY:"auto"},children:[(0,d.jsxs)("div",{className:"afmp-confirm-content",onClick:function(e){return e.stopPropagation()},style:{background:"white",borderRadius:"8px",padding:m<=480?"15px":m<=768?"20px":"25px",maxWidth:"450px",width:m<=480||m<=768?"calc(100% - 40px)":m<=1024?"85%":"90%",maxHeight:m<=1024?"85vh":"calc(100vh - 40px)",overflowY:"auto",boxShadow:"0 8px 32px rgba(0,0,0,0.2)",animation:"modalFadeIn 0.2s ease-out",margin:"auto"},children:[(0,d.jsxs)("h3",{style:{margin:"0 0 15px 0",color:"#1d2327",fontSize:m<=480?"16px":"18px",display:"flex",alignItems:"center",gap:"10px",wordBreak:"break-word"},children:[(0,d.jsx)("span",{children:x[h]||x.primary}),s]}),(0,d.jsx)("div",{className:"message",style:{marginBottom:"20px",lineHeight:"1.5",color:"#50575e",wordBreak:"break-word",overflowWrap:"break-word"},dangerouslySetInnerHTML:{__html:l}}),(0,d.jsxs)("div",{className:"buttons",style:{display:"flex",gap:"10px",justifyContent:"flex-end",flexWrap:m<=480?"wrap":"nowrap"},children:[(0,d.jsx)("button",{className:"button secondary cancel-btn",onClick:i,style:{padding:m<=480?"10px 16px":"8px 16px",border:"1px solid #ddd",borderRadius:"4px",cursor:"pointer",fontSize:m<=480?"13px":"14px",fontWeight:500,background:"#f6f7f7",color:"#50575e",flex:m<=480?"1 1 100%":"none",minWidth:m<=480?"100%":"auto",width:m<=480?"100%":"auto"},onMouseEnter:function(e){e.target.style.background="#e9ecef"},onMouseLeave:function(e){e.target.style.background="#f6f7f7"},children:f}),(0,d.jsx)("button",{className:"button ".concat(h," confirm-btn"),onClick:function(){a(),i()},style:{padding:m<=480?"10px 16px":"8px 16px",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:m<=480?"13px":"14px",fontWeight:500,background:"danger"===h?"#dc3545":"warning"===h?"#ffc107":"#007cba",color:"white",flex:m<=480?"1 1 100%":"none",minWidth:m<=480?"100%":"auto",width:m<=480?"100%":"auto"},onMouseEnter:function(e){e.target.style.background="danger"===h?"#c82333":"warning"===h?"#e0a800":"#005a87"},onMouseLeave:function(e){e.target.style.background="danger"===h?"#dc3545":"warning"===h?"#ffc107":"#007cba"},children:u})]})]}),(0,d.jsx)("style",{children:"\n        @keyframes modalFadeIn {\n          from {\n            opacity: 0;\n            transform: scale(0.9);\n          }\n          to {\n            opacity: 1;\n            transform: scale(1);\n          }\n        }\n      "})]})}function be(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function xe(e){var t,n,o=e.isOpen,i=e.onClose,a=e.commits,s=e.repo,l=e.branch,c=e.loading,u=(t=(0,r.useState)("undefined"!=typeof window?window.innerWidth:1024),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,n)||function(e,t){if(e){if("string"==typeof e)return be(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?be(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),p=u[0],f=u[1];if((0,r.useEffect)(function(){return document.body.style.overflow=o?"hidden":"",function(){document.body.style.overflow=""}},[o]),(0,r.useEffect)(function(){var e=function(){f(window.innerWidth)};if(o)return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}},[o]),(0,r.useEffect)(function(){var e=function(e){"Escape"===e.key&&o&&i()};return o&&document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}},[o,i]),!o)return null;var g=function(e){var t=document.createElement("div");return t.textContent=e,t.innerHTML};return(0,d.jsx)("div",{id:"afmp-commits-modal",onClick:function(e){e.target===e.currentTarget&&i()},style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",background:"rgba(0, 0, 0, 0.7)",zIndex:999999,display:"flex",alignItems:"center",justifyContent:"center",padding:p<=1024?"15px":"20px",overflowY:"auto"},children:(0,d.jsxs)("div",{className:"afmp-status-content",onClick:function(e){return e.stopPropagation()},style:{background:"#fff",width:p<=480||p<=768?"calc(100% - 40px)":p<=1024?"85%":"90%",maxWidth:"900px",maxHeight:p<=1024?"85vh":"calc(100vh - 40px)",padding:p<=480||p<=768?"15px":p<=1024?"18px":"20px",borderRadius:"5px",overflowY:"auto",position:"relative",margin:"auto"},children:[(0,d.jsx)("span",{className:"afmp-close-modal",onClick:i,style:{position:"absolute",right:p<=480?"10px":"15px",top:p<=480?"10px":"15px",cursor:"pointer",fontSize:p<=480?"28px":"24px",color:"#666",background:"none",border:"none",padding:"5px",zIndex:10,minWidth:"30px",minHeight:"30px",display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:function(e){return e.target.style.color="#000"},onMouseLeave:function(e){return e.target.style.color="#666"},children:"×"}),(0,d.jsx)("h2",{style:{margin:"0 0 20px 0",color:"#1d2327",fontSize:p<=768?"18px":"20px",paddingRight:"30px"},children:"GitHub Commits"}),c?(0,d.jsx)("div",{style:{padding:"20px",textAlign:"center"},children:(0,d.jsx)("p",{children:"Loading commits..."})}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"afmp-commits-header",style:{background:"#f8f9fa",padding:p<=768?"12px":"15px",margin:p<=768?"-15px -15px 15px -15px":"-20px -20px 20px -20px",borderBottom:"1px solid #dee2e6"},children:(0,d.jsx)("p",{style:{margin:0,fontSize:p<=768?"12px":"14px",color:"#495057",lineHeight:p<=768?"1.6":"1.5"},children:p<=768?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("strong",{children:"Repository:"})," ",s||"N/A"]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("strong",{children:"Branch:"})," ",l||"N/A"]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("strong",{children:"Total Commits:"})," ",a?a.length:0]})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("strong",{children:"Repository:"})," ",s||"N/A"," | ",(0,d.jsx)("strong",{children:"Branch:"})," ",l||"N/A"," | ",(0,d.jsx)("strong",{children:"Total Commits:"})," ",a?a.length:0]})})}),(0,d.jsx)("div",{id:"afmp-commits-list",children:a&&0!==a.length?(0,d.jsx)("div",{className:"afmp-commits-container",style:{maxHeight:p<=768?"400px":"500px",overflowY:"auto",border:"1px solid #ddd",borderRadius:"4px",background:"white"},children:a.map(function(e,t){return(0,d.jsxs)("div",{className:"afmp-commit-item",style:{padding:"15px",borderBottom:t<a.length-1?"1px solid #ddd":"none",background:"#f9f9f9",marginBottom:t<a.length-1?"10px":"0",borderRadius:"4px",position:"relative"},children:[(0,d.jsxs)("div",{className:"afmp-commit-header",style:{display:"flex",flexDirection:p<=480?"column":"row",justifyContent:"space-between",alignItems:p<=480?"flex-start":"center",marginBottom:"8px",gap:p<=480?"5px":"0"},children:[(0,d.jsx)("span",{className:"afmp-commit-sha",style:{fontFamily:"monospace",background:"#e1e1e1",padding:"2px 6px",borderRadius:"3px",fontSize:"12px",color:"#666"},children:e.sha}),(0,d.jsx)("span",{className:"afmp-commit-date",style:{fontSize:"12px",color:"#666"},children:(n=e.date,r=new Date(n),r.toLocaleDateString()+" "+r.toLocaleTimeString())})]}),(0,d.jsx)("div",{className:"afmp-commit-message",style:{fontWeight:600,marginBottom:"5px",color:"#333",lineHeight:"1.4"},dangerouslySetInnerHTML:{__html:g(e.message)}}),(0,d.jsxs)("div",{className:"afmp-commit-author",style:{fontSize:"12px",color:"#666",marginBottom:"10px"},children:["by ",g(e.author)]}),(0,d.jsx)("div",{className:"afmp-commit-actions-view-github",style:{textAlign:"right"},children:(0,d.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"button button-small",style:{fontSize:"11px",padding:"4px 8px",height:"auto",lineHeight:"1.2",minHeight:"24px",borderRadius:"3px",textDecoration:"none",background:"#0073aa",color:"white",border:"1px solid #0073aa",display:"inline-block"},onMouseEnter:function(e){e.target.style.background="#005a87",e.target.style.borderColor="#005a87"},onMouseLeave:function(e){e.target.style.background="#0073aa",e.target.style.borderColor="#0073aa"},children:"View on GitHub"})})]},t);var n,r})}):(0,d.jsx)("p",{style:{padding:"20px",textAlign:"center",color:"#666"},children:"No commits found in this branch."})})]})]})})}function ve(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return je(c,"_invoke",function(n,r,o){var i,s,l,c=0,u=o||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return i=t,s=0,l=e,p.n=n,a}};function f(n,r){for(s=n,l=r,t=0;!d&&c&&!o&&t<u.length;t++){var o,i=u[t],f=p.p,g=i[2];n>3?(o=g===r)&&(l=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=f&&((o=n<2&&f<i[1])?(s=0,p.v=r,p.n=i[1]):f<g&&(o=n<3||i[0]>r||r>g)&&(i[4]=n,i[5]=r,p.n=g,s=0))}if(o||n>1)return a;throw d=!0,r}return function(o,u,g){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,g),s=u,l=g;(t=s<2?e:l)||!d;){i||(s?s<3?(s>1&&(p.n=-1),f(s,l)):p.n=l:p.v=l);try{if(c=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(d=p.n<0)?l:n.call(r,p))!==a)break}catch(t){i=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,o,i),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(je(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,je(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,je(d,"constructor",c),je(c,"constructor",l),l.displayName="GeneratorFunction",je(c,o,"GeneratorFunction"),je(d),je(d,o,"Generator"),je(d,r,function(){return this}),je(d,"toString",function(){return"[object Generator]"}),(ve=function(){return{w:i,m:p}})()}function je(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}je=function(e,t,n,r){function i(t,n){je(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},je(e,t,n,r)}function we(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function ke(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){we(i,r,o,a,s,"next",e)}function s(e){we(i,r,o,a,s,"throw",e)}a(void 0)})}}function Se(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||_e(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _e(e,t){if(e){if("string"==typeof e)return Oe(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Oe(e,t):void 0}}function Oe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Te(e){var t=e.isOpen,n=e.onClose,o=e.changedFiles,i=e.repo,a=e.branch,s=e.loading,l=e.onPush,c=e.onDiscard,u=e.githubNonce,p=e.ajaxUrl,f=e.setMessage,g=Se((0,r.useState)([]),2),h=g[0],y=g[1],m=Se((0,r.useState)(!0),2),b=m[0],x=m[1],v=Se((0,r.useState)("Updated files via AFM"),2),j=v[0],w=v[1],k=Se((0,r.useState)(""),2),S=k[0],_=k[1],O=Se((0,r.useState)(!1),2),T=O[0],P=O[1],C=Se((0,r.useState)(!1),2),I=C[0],A=C[1],E=Se((0,r.useState)(!1),2),F=E[0],D=E[1],R=Se((0,r.useState)("undefined"!=typeof window?window.innerWidth:1024),2),W=R[0],M=R[1];if((0,r.useEffect)(function(){return t?(document.body.style.overflow="hidden",o&&o.length>0&&(y(o.map(function(e){return e.path})),x(!0))):document.body.style.overflow="",function(){document.body.style.overflow=""}},[t,o]),(0,r.useEffect)(function(){var e=function(){M(window.innerWidth)};if(t)return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}},[t]),(0,r.useEffect)(function(){var e=function(e){"Escape"===e.key&&t&&n()};return t&&document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}},[t,n]),(0,r.useEffect)(function(){o&&o.length>0&&x(h.length===o.length)},[h,o]),!t)return null;var G=function(){var e=ke(ve().m(function e(){var t,r,o,i,a,s,c,d;return ve().w(function(e){for(;;)switch(e.p=e.n){case 0:if(0!==h.length){e.n=1;break}return f&&(f({type:"warning",text:"Please select at least one file to push"}),setTimeout(function(){return f(null)},3e3)),e.a(2);case 1:if(j.trim()){e.n=2;break}return f&&(f({type:"warning",text:"Please enter a commit message"}),setTimeout(function(){return f(null)},3e3)),e.a(2);case 2:return P(!0),e.p=3,(t=new FormData).append("action","afmp_push_files_with_summary"),t.append("nonce",u),h.forEach(function(e){t.append("selected_files[]",e)}),t.append("commit_message",j.trim()),t.append("commit_description",S.trim()),e.n=4,fetch(p,{method:"POST",body:t});case 4:return r=e.v,e.n=5,r.json();case 5:(o=e.v).success?(i=o.data,a="Successfully created commit with ".concat(i.pushed_count," file(s)!"),i.commit_url&&(a+="\n\nView Commit on GitHub: ".concat(i.commit_url)),i.commit_sha&&(a+="\nCommit SHA: ".concat(i.commit_sha.substring(0,7))),i.failed_count>0&&(a+="\n\nSome files failed:",i.failed_files.forEach(function(e){a+="\n• ".concat(e.file,": ").concat(e.error)})),f&&(f({type:"success",text:a}),setTimeout(function(){return f(null)},1e4)),n(),l&&l()):(s=o.data,c="Failed to push files to GitHub!",s&&s.message&&(c+="\n\nError: "+s.message),s&&s.failed_files&&s.failed_files.length>0&&(c+="\n\nFailed files:",s.failed_files.forEach(function(e){c+="\n• ".concat(e.file,": ").concat(e.error)})),f&&(f({type:"error",text:c}),setTimeout(function(){return f(null)},12e3))),e.n=7;break;case 6:e.p=6,d=e.v,console.error("Error pushing files:",d),f&&(f({type:"error",text:"Network error occurred while pushing to GitHub"}),setTimeout(function(){return f(null)},5e3));case 7:return e.p=7,P(!1),e.f(7);case 8:return e.a(2)}},e,null,[[3,6,7,8]])}));return function(){return e.apply(this,arguments)}}(),z=function(){var e=ke(ve().m(function e(){return ve().w(function(e){for(;;)switch(e.n){case 0:if(0!==h.length){e.n=1;break}return f&&(f({type:"warning",text:"Please select at least one file to discard changes"}),setTimeout(function(){return f(null)},3e3)),e.a(2);case 1:D(!0);case 2:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}(),B=function(){var e=ke(ve().m(function e(){var t,r,o,i,a,s,l,d;return ve().w(function(e){for(;;)switch(e.p=e.n){case 0:return D(!1),A(!0),e.p=1,(t=new FormData).append("action","afmp_discard_file_changes"),t.append("nonce",u),h.forEach(function(e){t.append("selected_files[]",e)}),e.n=2,fetch(p,{method:"POST",body:t});case 2:return r=e.v,e.n=3,r.json();case 3:(o=e.v).success?(i=o.data,a="",a=i.discarded_count>0?"Successfully discarded changes for ".concat(i.discarded_count," file(s)!"):"No changes to discard. Files are already in sync with GitHub.",i.failed_count>0&&(a+="\n\nFailed files:",i.failed_files.forEach(function(e){a+="\n• ".concat(e.file,": ").concat(e.error)})),f&&(f({type:"success",text:a}),setTimeout(function(){return f(null)},7e3)),n(),c&&c(),setTimeout(function(){window.location.reload()},2e3)):(s=o.data,l="Failed to discard changes!",s&&s.failed_files&&s.failed_files.length>0?(l+="\n\nErrors:",s.failed_files.forEach(function(e){l+="\n• ".concat(e.file,": ").concat(e.error)})):s&&0===s.discarded_count&&0===s.failed_count&&(l="No files were selected or files are already in sync."),f&&(f({type:"error",text:l}),setTimeout(function(){return f(null)},1e4))),e.n=5;break;case 4:e.p=4,d=e.v,console.error("Error discarding changes:",d),f&&(f({type:"error",text:"Network error occurred while discarding changes"}),setTimeout(function(){return f(null)},5e3));case 5:return e.p=5,A(!1),e.f(5);case 6:return e.a(2)}},e,null,[[1,4,5,6]])}));return function(){return e.apply(this,arguments)}}(),N=function(e){var t=document.createElement("div");return t.textContent=e,t.innerHTML},U=o?o.length:0,L=o?o.reduce(function(e,t){return e+(t.changes_count||0)},0):0;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{id:"afmp-push-modal",onClick:function(e){e.target===e.currentTarget&&n()},style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",background:"rgba(0, 0, 0, 0.7)",zIndex:999999,display:"flex",alignItems:"center",justifyContent:"center",padding:W<=1024?"15px":"20px",overflowY:"auto"},children:(0,d.jsxs)("div",{className:"afmp-status-content",onClick:function(e){return e.stopPropagation()},style:{background:"#fff",width:W<=480||W<=768?"calc(100% - 40px)":W<=1024?"85%":"90%",maxWidth:"1200px",maxHeight:W<=1024?"85vh":"calc(100vh - 40px)",padding:W<=480||W<=768?"15px":W<=1024?"18px":"20px",borderRadius:"5px",overflowY:"auto",position:"relative",margin:"auto"},children:[(0,d.jsx)("span",{className:"afmp-close-modal",onClick:n,style:{position:"absolute",right:W<=480?"10px":"15px",top:W<=480?"10px":"15px",cursor:"pointer",fontSize:W<=480?"28px":"24px",color:"#666",background:"none",border:"none",padding:"5px",zIndex:10,minWidth:"30px",minHeight:"30px",display:"flex",alignItems:"center",justifyContent:"center"},onMouseEnter:function(e){return e.target.style.color="#000"},onMouseLeave:function(e){return e.target.style.color="#666"},children:"×"}),(0,d.jsx)("h2",{style:{margin:"0 0 20px 0",color:"#1d2327",fontSize:W<=768?"18px":"20px",paddingRight:"30px"},children:"Push Changes to GitHub"}),s?(0,d.jsx)("div",{style:{padding:"20px",textAlign:"center"},children:(0,d.jsx)("p",{children:"Loading changed files..."})}):o&&0!==o.length?(0,d.jsxs)("div",{className:"afmp-push-modal-content",style:{display:"flex",flexDirection:W<=1024?"column":"row",gap:W<=768?"15px":"20px",maxHeight:W<=768?"75vh":"70vh",overflow:"hidden"},children:[(0,d.jsxs)("div",{className:"afmp-commit-section",style:{flex:W<=1024?"none":"0 0 300px",background:"#f8f9fa",padding:W<=480?"12px":W<=768?"15px":"20px",borderRadius:"6px",border:"1px solid #e1e5e9",position:W<=1024?"static":"sticky",top:0,height:"fit-content",maxHeight:W<=1024?"none":"60vh",overflowY:"auto"},children:[(0,d.jsxs)("h3",{style:{margin:"0 0 15px 0",color:"#1d2327",fontSize:W<=480?"14px":"16px",borderBottom:"1px solid #ddd",paddingBottom:"10px",wordBreak:"break-word"},children:[(0,d.jsx)("span",{style:{marginRight:"8px"},children:"📝"})," Commit Details"]}),(0,d.jsxs)("div",{style:{marginBottom:"15px"},children:[(0,d.jsxs)("label",{style:{display:"block",marginBottom:"5px",fontWeight:600,color:"#1d2327"},children:["Commit Message ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsx)("input",{type:"text",id:"afmp-commit-message",value:j,onChange:function(e){return w(e.target.value)},placeholder:"Updated files via AFM",required:!0,style:{width:"100%",padding:"8px 12px",border:"1px solid #ddd",borderRadius:"4px",fontSize:"14px",boxSizing:"border-box"}})]}),(0,d.jsxs)("div",{style:{marginBottom:"15px"},children:[(0,d.jsx)("label",{style:{display:"block",marginBottom:"5px",fontWeight:600,color:"#1d2327"},children:"Description (Optional)"}),(0,d.jsx)("textarea",{id:"afmp-commit-description",value:S,onChange:function(e){return _(e.target.value)},rows:3,placeholder:"Detailed description of changes...",style:{width:"100%",padding:"8px 12px",border:"1px solid #ddd",borderRadius:"4px",fontSize:"14px",resize:"vertical",minHeight:"60px",boxSizing:"border-box"}})]}),(0,d.jsx)("div",{className:"afmp-commit-actions",style:{paddingTop:"15px",borderTop:"1px solid #ddd"},children:(0,d.jsxs)("div",{className:"afmp-bulk-actions",style:{display:"flex",flexDirection:"column",gap:W<=480?"8px":"10px"},children:[(0,d.jsx)("button",{type:"button",id:"afmp-push-selected-btn",onClick:G,disabled:0===h.length||T||!j.trim(),style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"5px",padding:W<=480?"12px 16px":"10px 16px",fontWeight:500,textAlign:"center",width:"100%",boxSizing:"border-box",background:0===h.length||T||!j.trim()?"#ccc":"#007cba",border:"none",borderRadius:"4px",color:"white",cursor:0===h.length||T||!j.trim()?"not-allowed":"pointer",fontSize:W<=480?"12px":"14px",wordBreak:"break-word",whiteSpace:W<=480?"normal":"nowrap"},onMouseEnter:function(e){e.target.disabled||(e.target.style.background="#005a87")},onMouseLeave:function(e){e.target.disabled||(e.target.style.background="#007cba")},children:T?"⏳ Creating commit...":h.length>0?"📤 Push ".concat(h.length," file(s) to GitHub"):"📤 Select files to push"}),(0,d.jsx)("button",{type:"button",id:"afmp-discard-selected-btn",onClick:z,disabled:0===h.length||I,style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"5px",padding:W<=480?"12px 16px":"10px 16px",fontWeight:500,textAlign:"center",width:"100%",boxSizing:"border-box",background:0===h.length||I?"#ccc":"#dc3545",border:"none",borderRadius:"4px",color:"white",cursor:0===h.length||I?"not-allowed":"pointer",fontSize:W<=480?"12px":"14px",wordBreak:"break-word",whiteSpace:W<=480?"normal":"nowrap"},onMouseEnter:function(e){e.target.disabled||(e.target.style.background="#c82333")},onMouseLeave:function(e){e.target.disabled||(e.target.style.background="#dc3545")},children:I?"⏳ Discarding changes...":h.length>0?"🗑️ Discard ".concat(h.length," file(s) changes"):"🗑️ Select files to discard"})]})})]}),(0,d.jsxs)("div",{className:"afmp-files-section",style:{flex:1,display:"flex",flexDirection:"column",minWidth:0},children:[(0,d.jsxs)("h3",{style:{margin:"0 0 15px 0",color:"#1d2327",fontSize:W<=480?"14px":"16px",flexShrink:0,wordBreak:"break-word"},children:[(0,d.jsx)("span",{style:{marginRight:"8px"},children:"📄"})," Changed Files (",U,")"]}),(0,d.jsx)("div",{className:"afmp-files-selection",style:{padding:"10px",background:"#e7f3ff",borderRadius:"4px",marginBottom:"15px",flexShrink:0},children:(0,d.jsxs)("label",{style:{fontWeight:600,color:"#004085",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px"},children:[(0,d.jsx)("input",{type:"checkbox",id:"afmp-select-all-files",checked:b,onChange:function(e){return t=e.target.checked,x(t),void y(t?o.map(function(e){return e.path}):[]);var t},style:{margin:0}}),"Select All Files"]})}),(0,d.jsx)("div",{className:"afmp-files-container",style:{flex:1,overflowY:"auto",maxHeight:W<=768?"40vh":"50vh",paddingRight:W<=768?"5px":"10px"},children:o.map(function(e,t){var n=e.status.toLowerCase(),r="New"===e.status?"➕":"✏️",o=h.includes(e.path),i="new"===n?"#28a745":"#ffc107",a="new"===n?"#f8fff8":"#fffef8";return(0,d.jsxs)("div",{className:"afmp-file-item ".concat(n),style:{border:"1px solid #ddd",borderLeft:"4px solid ".concat(i),borderRadius:"6px",marginBottom:"12px",overflow:"hidden",background:a},children:[(0,d.jsx)("div",{className:"afmp-file-header",style:{padding:"12px 15px",background:"#fff",borderBottom:"1px solid #eee"},children:(0,d.jsxs)("label",{className:"afmp-file-checkbox",style:{display:"flex",alignItems:"center",gap:"10px",cursor:"pointer",width:"100%"},children:[(0,d.jsx)("input",{type:"checkbox",className:"afmp-file-select",checked:o,onChange:function(t){return r=e.path,o=t.target.checked,void y(o?[].concat((n=h,function(e){if(Array.isArray(e))return Oe(e)}(n)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||_e(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),[r]):h.filter(function(e){return e!==r}));var n,r,o},style:{margin:0,flexShrink:0}}),(0,d.jsx)("span",{className:"afmp-file-status",style:{fontSize:"16px",flexShrink:0},children:r}),(0,d.jsx)("strong",{style:{flex:1,wordBreak:"break-word"},children:N(e.path)}),(0,d.jsxs)("span",{className:"afmp-file-meta",style:{color:"#666",fontSize:"13px",marginLeft:"auto",flexShrink:0},children:["(",e.status," - ",e.changes_count||0," changes)"]})]})}),"New"===e.status?(0,d.jsx)("div",{className:"afmp-file-details",style:{padding:"15px",background:"#f8f9fa"},children:(0,d.jsxs)("p",{style:{margin:0,fontStyle:"italic"},children:["New file - ",e.file_size||0," bytes"]})}):e.changes&&e.changes.length>0?(0,d.jsx)("div",{className:"afmp-file-details",style:{padding:"15px",background:"#f8f9fa"},children:(0,d.jsxs)("div",{className:"afmp-changes-preview",style:{fontSize:"13px"},children:[(0,d.jsxs)("strong",{children:["All Changes (",e.changes.length,"):"]}),(0,d.jsx)("div",{className:"afmp-changes-list afmp-scrollable-changes",style:{marginTop:"10px",maxHeight:"200px",overflowY:"auto",background:"#f8f9fa",border:"1px solid #dee2e6",borderRadius:"4px",padding:0},children:e.changes.map(function(t,n){return(0,d.jsxs)("div",{className:"afmp-change-item change-".concat(t.type),style:{padding:"8px 12px",borderBottom:n<e.changes.length-1?"1px solid #eee":"none"},children:[(0,d.jsxs)("span",{className:"afmp-line-number",style:{color:"#666",fontWeight:600,marginRight:"10px"},children:["Line ",t.line_number,":"]}),"added"===t.type?(0,d.jsxs)("div",{className:"afmp-change-line added",style:{fontFamily:"monospace",fontSize:"12px",padding:"2px 4px",margin:"2px 0",borderRadius:"2px",wordBreak:"break-all",background:"#d4edda",color:"#155724"},children:["+ ",N(t.local_line)]}):"removed"===t.type?(0,d.jsxs)("div",{className:"afmp-change-line removed",style:{fontFamily:"monospace",fontSize:"12px",padding:"2px 4px",margin:"2px 0",borderRadius:"2px",wordBreak:"break-all",background:"#f8d7da",color:"#721c24"},children:["- ",N(t.github_line)]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"afmp-change-line removed",style:{fontFamily:"monospace",fontSize:"12px",padding:"2px 4px",margin:"2px 0",borderRadius:"2px",wordBreak:"break-all",background:"#f8d7da",color:"#721c24"},children:["- ",N(t.github_line)]}),(0,d.jsxs)("div",{className:"afmp-change-line added",style:{fontFamily:"monospace",fontSize:"12px",padding:"2px 4px",margin:"2px 0",borderRadius:"2px",wordBreak:"break-all",background:"#d4edda",color:"#155724"},children:["+ ",N(t.local_line)]})]})]},n)})})]})}):null]},t)})})]})]}):(0,d.jsx)("div",{style:{padding:"20px",textAlign:"center"},children:(0,d.jsx)("p",{children:"No changed files found. All files are up to date."})}),!s&&o&&o.length>0&&(0,d.jsxs)("div",{className:"afmp-status-summary",style:{flexShrink:0,marginTop:"15px",padding:W<=768?"12px":"15px",background:"#f0f0f1",borderRadius:"4px",border:"1px solid #ddd",fontSize:W<=768?"13px":"14px"},children:[(0,d.jsx)("strong",{children:"Summary:"})," ",U," files with ",L," total changes",(0,d.jsx)("br",{}),(0,d.jsx)("strong",{children:"Repository:"})," ",i||"N/A"," (",a||"N/A"," branch)"]})]})}),F&&(0,d.jsx)(me,{isOpen:F,onClose:function(){return D(!1)},onConfirm:B,title:"Discard Changes",message:"Are you sure you want to discard changes for <strong>".concat(h.length," file(s)</strong>?<br><br>Modified files will be restored from GitHub. New local-only files will be deleted. This cannot be undone."),confirmText:"Yes, Discard Changes",cancelText:"Cancel",type:"danger"})]})}function Pe(e){return Pe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Pe(e)}function Ce(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ie(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ce(Object(n),!0).forEach(function(t){Ae(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ce(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ae(e,t,n){return(t=function(e){var t=function(e){if("object"!=Pe(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Pe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Pe(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ee(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return Fe(c,"_invoke",function(n,r,o){var i,s,l,c=0,u=o||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return i=t,s=0,l=e,p.n=n,a}};function f(n,r){for(s=n,l=r,t=0;!d&&c&&!o&&t<u.length;t++){var o,i=u[t],f=p.p,g=i[2];n>3?(o=g===r)&&(l=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=f&&((o=n<2&&f<i[1])?(s=0,p.v=r,p.n=i[1]):f<g&&(o=n<3||i[0]>r||r>g)&&(i[4]=n,i[5]=r,p.n=g,s=0))}if(o||n>1)return a;throw d=!0,r}return function(o,u,g){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,g),s=u,l=g;(t=s<2?e:l)||!d;){i||(s?s<3?(s>1&&(p.n=-1),f(s,l)):p.n=l:p.v=l);try{if(c=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(d=p.n<0)?l:n.call(r,p))!==a)break}catch(t){i=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,o,i),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Fe(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Fe(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,Fe(d,"constructor",c),Fe(c,"constructor",l),l.displayName="GeneratorFunction",Fe(c,o,"GeneratorFunction"),Fe(d),Fe(d,o,"Generator"),Fe(d,r,function(){return this}),Fe(d,"toString",function(){return"[object Generator]"}),(Ee=function(){return{w:i,m:p}})()}function Fe(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Fe=function(e,t,n,r){function i(t,n){Fe(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},Fe(e,t,n,r)}function De(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function Re(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){De(i,r,o,a,s,"next",e)}function s(e){De(i,r,o,a,s,"throw",e)}a(void 0)})}}function We(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Me(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Me(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Me(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ge(e){var t,n=e.settings,o=e.hasPro,i=e.root,a=e.nonce,s=e.setMessage,l=e.onSettingsRefresh,c=n.ajax_nonce||a,p=n.ajax_url||(null===(t=window.afmReact)||void 0===t?void 0:t.ajaxUrl)||"/wp-admin/admin-ajax.php",f=n.pat||n.token||"",g=We((0,r.useState)(!1),2),h=g[0],y=g[1],m=We((0,r.useState)(!1),2),b=m[0],x=m[1],v=We((0,r.useState)([]),2),j=v[0],w=v[1],k=We((0,r.useState)([]),2),S=k[0],_=k[1],O=We((0,r.useState)(n.repo||""),2),T=O[0],P=O[1],C=We((0,r.useState)(n.branch||""),2),I=C[0],A=C[1],E=We((0,r.useState)(!1),2),F=(E[0],E[1]),D=We((0,r.useState)(!1),2),R=D[0],W=D[1],M=We((0,r.useState)(!1),2),G=M[0],z=M[1],B=We((0,r.useState)(!1),2),N=B[0],U=B[1],L=We((0,r.useState)(!1),2),H=L[0],V=L[1],K=We((0,r.useState)(!1),2),X=K[0],Y=K[1],$=We((0,r.useState)(!1),2),q=$[0],J=$[1],Z=We((0,r.useState)(null),2),Q=Z[0],ee=Z[1],te=We((0,r.useState)(!1),2),ne=te[0],re=te[1],oe=We((0,r.useState)([]),2),ie=oe[0],ae=oe[1],se=We((0,r.useState)(!1),2),le=se[0],ce=se[1],ue=We((0,r.useState)(!1),2),de=ue[0],pe=ue[1],fe=We((0,r.useState)([]),2),ge=fe[0],he=fe[1],ye=We((0,r.useState)(!1),2),be=ye[0],ve=ye[1],je=We((0,r.useState)(!1),2),we=je[0],ke=je[1],Se=(0,r.useRef)(!1),_e=(0,r.useCallback)(function(){var e,t;return{username:(null===(e=document.getElementById("username"))||void 0===e?void 0:e.value)||n.username||"",token:(null===(t=document.getElementById("pat"))||void 0===t?void 0:t.value)||f}},[n.username,f]),Oe=(0,r.useCallback)(Re(Ee().m(function e(){var t,n,r,o,l,c,u,d,p,f,g=arguments;return Ee().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t=(g.length>0&&void 0!==g[0]?g[0]:{}).silent,n=void 0!==t&&t,r=_e(),o=r.username,l=r.token,o&&l){e.n=1;break}return!n&&s&&(s({type:"error",text:"Please enter GitHub Username and PAT first."}),setTimeout(function(){return s(null)},3e3)),e.a(2,!1);case 1:return y(!0),e.p=2,e.n=3,fetch("".concat(i,"file-manager-advanced/v1/integrations/github/fetch-repositories"),{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":a},body:JSON.stringify({username:o,token:l})});case 3:return u=e.v,e.n=4,u.json();case 4:if(d=e.v,!u.ok||!d.success){e.n=5;break}return w(d.repositories||[]),!n&&s&&(s({type:"success",text:"Successfully fetched ".concat(d.repositories.length," repositories!")}),setTimeout(function(){return s(null)},3e3)),e.a(2,!0);case 5:return p=d.message||(null===(c=d.data)||void 0===c?void 0:c.message)||"Failed to fetch repositories",!n&&s&&(s({type:"error",text:p}),setTimeout(function(){return s(null)},3e3)),e.a(2,!1);case 6:return e.p=6,f=e.v,console.error("Error fetching repositories:",f),!n&&s&&(s({type:"error",text:"Failed to fetch repositories. Please try again."}),setTimeout(function(){return s(null)},3e3)),e.a(2,!1);case 7:return e.p=7,y(!1),e.f(7);case 8:return e.a(2)}},e,null,[[2,6,7,8]])})),[_e,i,a,s]),Pe=(0,r.useCallback)(function(){var e=Re(Ee().m(function e(t){var n,r,o,u,d,f,g,h,y,m,b,v,j,w,k,S,O,T,P,C,I,E=arguments;return Ee().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=(n=E.length>1&&void 0!==E[1]?E[1]:{}).silent,o=void 0!==r&&r,u=n.preferredBranch,d=void 0===u?"":u,f=n.autoSaveDefault,g=void 0!==f&&f,h=_e(),y=h.username,m=h.token,t&&y&&m){e.n=1;break}return e.a(2,!1);case 1:return x(!0),e.p=2,e.n=3,fetch("".concat(i,"file-manager-advanced/v1/integrations/github/fetch-branches"),{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":a},body:JSON.stringify({username:y,token:m,repo:t})});case 3:return v=e.v,e.n=4,v.json();case 4:if(j=e.v,!v.ok||!j.success){e.n=12;break}if(w=j.branches||[],_(w),(k=d)&&w.find(function(e){return e.name===k})||(S=w.find(function(e){return e.default}))&&(k=S.name),k&&A(k),!g||!k){e.n=10;break}return e.p=5,(O=new FormData).append("action","afmp_save_github_settings"),O.append("nonce",c),O.append("repo",t),O.append("branch",k),e.n=6,fetch(p,{method:"POST",body:O});case 6:return T=e.v,e.n=7,T.json();case 7:e.v.success?(l&&l(),!o&&s&&(s({type:"success",text:"Repository and branch saved successfully!"}),setTimeout(function(){return s(null)},3e3))):console.error("Failed to save GitHub settings"),e.n=9;break;case 8:e.p=8,C=e.v,console.error("Error saving GitHub settings:",C);case 9:e.n=11;break;case 10:!o&&s&&(s({type:"success",text:"Successfully fetched branches for ".concat(t,"!")}),setTimeout(function(){return s(null)},3e3));case 11:return e.a(2,!0);case 12:return P=j.message||(null===(b=j.data)||void 0===b?void 0:b.message)||"Failed to fetch branches",!o&&s&&(s({type:"error",text:P}),setTimeout(function(){return s(null)},3e3)),e.a(2,!1);case 13:return e.p=13,I=e.v,console.error("Error fetching branches:",I),!o&&s&&(s({type:"error",text:"Failed to fetch branches. Please try again."}),setTimeout(function(){return s(null)},3e3)),e.a(2,!1);case 14:return e.p=14,x(!1),e.f(14);case 15:return e.a(2)}},e,null,[[5,8],[2,13,14,15]])}));return function(t){return e.apply(this,arguments)}}(),[p,_e,c,a,l,i,s]);(0,r.useEffect)(function(){var e=function(){var e=Re(Ee().m(function e(){var t,r,o,s;return Ee().w(function(e){for(;;)switch(e.p=e.n){case 0:if(n.username&&f){e.n=1;break}return Y(!1),F(!1),e.a(2);case 1:return W(!0),e.p=2,e.n=3,fetch("".concat(i,"file-manager-advanced/v1/integrations/github/validate-token"),{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":a},body:JSON.stringify({token:f})});case 3:return t=e.v,e.n=4,t.json();case 4:r=e.v,o=t.ok&&r.success,F(o),Y(o),e.n=6;break;case 5:e.p=5,s=e.v,console.error("Error validating token:",s),F(!1),Y(!1);case 6:return e.p=6,W(!1),e.f(6);case 7:return e.a(2)}},e,null,[[2,5,6,7]])}));return function(){return e.apply(this,arguments)}}();e()},[n.username,f,i,a]),(0,r.useEffect)(function(){if(X&&!R&&!Se.current){Se.current=!0;var e=function(){var e=Re(Ee().m(function e(){return Ee().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,Oe({silent:!0});case 1:if(e.v&&n.repo){e.n=2;break}return e.a(2);case 2:return P(n.repo),e.n=3,Pe(n.repo,{silent:!0,preferredBranch:n.branch||""});case 3:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}();e()}},[X,R,n.repo,n.branch,Oe,Pe]),(0,r.useEffect)(function(){n.username&&f||(Se.current=!1)},[n.username,f]),(0,r.useEffect)(function(){n.repo&&P(n.repo),n.branch&&A(n.branch)},[n.repo,n.branch]);var Ce=function(){var e=Re(Ee().m(function e(){return Ee().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,Oe({silent:!1});case 1:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}(),Ae=function(){var e=Re(Ee().m(function e(t){var n;return Ee().w(function(e){for(;;)switch(e.n){case 0:if(n=t.target.value,P(n),_([]),A(""),n){e.n=1;break}return e.a(2);case 1:return e.n=2,Pe(n,{silent:!1,preferredBranch:"",autoSaveDefault:!0});case 2:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),Fe=function(){var e=Re(Ee().m(function e(){var t,r;return Ee().w(function(e){for(;;)switch(e.n){case 0:if(T&&I){e.n=1;break}return s&&(s({type:"error",text:"Please select a repository and branch first."}),setTimeout(function(){return s(null)},3e3)),e.a(2);case 1:t=n.access_dir||"uploads/afmp-includes/github",r="Are you sure you want to pull all files from <strong>".concat(T,"</strong> (").concat(I," branch)?<br><br>This will download all files from the selected branch to <strong>").concat(t,"</strong>. This will overwrite any local changes with the GitHub versions."),ee({title:"Pull Files from GitHub",message:r,confirmText:"Yes, Pull Files",cancelText:"Cancel",type:"warning",onConfirm:function(){var e=Re(Ee().m(function e(){var t,n,r,o,i;return Ee().w(function(e){for(;;)switch(e.p=e.n){case 0:return z(!0),e.p=1,(t=new FormData).append("action","afmp_pull_files"),t.append("nonce",c),t.append("repo",T),t.append("branch",I),e.n=2,fetch(p,{method:"POST",body:t});case 2:return n=e.v,e.n=3,n.json();case 3:(r=e.v).success?s&&(s({type:"success",text:r.data||"Files pulled successfully from GitHub!"}),setTimeout(function(){return s(null)},5e3)):(o=r.data||"Failed to pull files from GitHub",s&&(s({type:"error",text:o}),setTimeout(function(){return s(null)},5e3))),e.n=5;break;case 4:e.p=4,i=e.v,console.error("Error pulling files:",i),s&&(s({type:"error",text:"Failed to pull files. Please try again."}),setTimeout(function(){return s(null)},5e3));case 5:return e.p=5,z(!1),e.f(5);case 6:return e.a(2)}},e,null,[[1,4,5,6]])}));return function(){return e.apply(this,arguments)}}()}),J(!0);case 2:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}(),De=function(){var e=Re(Ee().m(function e(){var t,n,r,o,i,a,l;return Ee().w(function(e){for(;;)switch(e.p=e.n){case 0:if(T&&I){e.n=1;break}return s&&(s({type:"error",text:"Please select a repository and branch first."}),setTimeout(function(){return s(null)},3e3)),e.a(2);case 1:return U(!0),ce(!0),re(!0),e.p=2,(t=new FormData).append("action","afmp_get_commits"),t.append("nonce",c),e.n=3,fetch(p,{method:"POST",body:t});case 3:return n=e.v,e.n=4,n.json();case 4:(r=e.v).success?(i=(null===(o=r.data)||void 0===o?void 0:o.commits)||[],ae(i)):(a=r.data||"Failed to fetch commits",ae([]),s&&(s({type:"error",text:a}),setTimeout(function(){return s(null)},5e3))),e.n=6;break;case 5:e.p=5,l=e.v,console.error("Error checking status:",l),ae([]),s&&(s({type:"error",text:"Failed to check status. Please try again."}),setTimeout(function(){return s(null)},5e3));case 6:return e.p=6,U(!1),ce(!1),e.f(6);case 7:return e.a(2)}},e,null,[[2,5,6,7]])}));return function(){return e.apply(this,arguments)}}(),Me=function(){var e=Re(Ee().m(function e(){var t,n,r,o,i;return Ee().w(function(e){for(;;)switch(e.p=e.n){case 0:if(T&&I){e.n=1;break}return s&&(s({type:"error",text:"Please select a repository and branch first."}),setTimeout(function(){return s(null)},3e3)),e.a(2);case 1:return V(!0),ve(!0),pe(!0),e.p=2,(t=new FormData).append("action","afmp_get_changed_files_for_push"),t.append("nonce",c),e.n=3,fetch(p,{method:"POST",body:t});case 3:return n=e.v,e.n=4,n.json();case 4:(r=e.v).success&&r.data&&r.data.files?he(r.data.files||[]):(he([]),s&&(o=r.data||"Failed to get changed files",s({type:"error",text:o}),setTimeout(function(){return s(null)},5e3))),e.n=6;break;case 5:e.p=5,i=e.v,console.error("Error fetching changed files:",i),he([]),s&&(s({type:"error",text:"Failed to fetch changed files. Please try again."}),setTimeout(function(){return s(null)},5e3));case 6:return e.p=6,V(!1),ve(!1),e.f(6);case 7:return e.a(2)}},e,null,[[2,5,6,7]])}));return function(){return e.apply(this,arguments)}}(),Ge=X,ze=Boolean(T&&I),Be=!o||!ze,Ne=function(e,t){return{padding:"10px 20px",background:Be||t?"#ccc":e,color:"#fff",border:"none",borderRadius:"4px",fontSize:"14px",fontWeight:600,cursor:Be||t?"not-allowed":"pointer",transition:"background-color 0.2s ease",marginRight:"10px"}};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"title",style:u.label,children:"Alias"}),(0,d.jsx)("input",{type:"text",id:"title",name:"title",defaultValue:n.title||"Github",disabled:!o,style:Ie(Ie({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter a title which will be displayed on File Manager"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"email",style:u.label,children:"GitHub Email"}),(0,d.jsx)("input",{type:"email",id:"email",name:"email",defaultValue:n.email||"",disabled:!o,style:Ie(Ie({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter your email which you use for your GitHub account"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"username",style:u.label,children:["GitHub Username ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsx)("input",{type:"text",id:"username",name:"username",defaultValue:n.username||"",disabled:!o,readOnly:Ge,style:Ie(Ie({},u.input),{},{maxWidth:"500px"},Ge?{background:"#f5f5f5",cursor:"not-allowed"}:{})}),(0,d.jsx)("p",{style:u.description,children:"Enter your GitHub username"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"pat",style:u.label,children:["GitHub PAT ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsxs)("div",{style:{position:"relative",maxWidth:"500px"},children:[(0,d.jsx)("input",{type:we?"text":"password",id:"pat",name:"pat",defaultValue:f,disabled:!o,readOnly:Ge,style:Ie(Ie({},u.input),{},{paddingRight:"40px"},Ge?{background:"#f5f5f5",cursor:"not-allowed"}:{})}),(0,d.jsx)("button",{type:"button",onClick:function(){return ke(!we)},disabled:!o||Ge,style:{position:"absolute",right:"10px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:!o||Ge?"not-allowed":"pointer",padding:"5px",display:"flex",alignItems:"center",justifyContent:"center",color:"#666",zIndex:10,opacity:!o||Ge?.5:1},title:we?"Hide PAT":"Show PAT",children:we?(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),(0,d.jsx)("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})})]}),(0,d.jsxs)("p",{style:u.description,children:["Enter GitHub Personal Access Token (PAT) for your account"," ",(0,d.jsx)("a",{href:"https://github.com/settings/tokens",target:"_blank",rel:"noopener noreferrer",style:u.link,children:"Click here to get Github PAT"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"access_dir",style:u.label,children:"GitHub Access Directory"}),(0,d.jsx)("input",{type:"text",id:"access_dir",value:n.access_dir||"uploads/afmp-includes/github",readOnly:!0,disabled:!o,style:Ie(Ie({},u.input),{},{maxWidth:"500px",background:"#f5f5f5",cursor:"not-allowed"})}),(0,d.jsx)("p",{style:u.description,children:"Your GitHub files will be saved in this directory."})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"master_dir",style:u.label,children:"GitHub Master Access Directory"}),(0,d.jsx)("input",{type:"text",id:"master_dir",name:"master_dir",defaultValue:n.master_dir||"",disabled:!o,style:Ie(Ie({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"This field is not a required, and if left empty all configuration will apply to the whole repository"})]}),X&&!R?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{style:{marginTop:"20px",paddingTop:"20px",borderTop:"1px solid #e5e5e5"},children:[(0,d.jsx)("label",{style:u.label,children:"GitHub Actions"}),(0,d.jsxs)("div",{style:{marginTop:"10px"},children:[(0,d.jsx)("button",{type:"button",onClick:Ce,disabled:!o||h||b,style:Ie(Ie({},u.installButton),{},{background:!o||h?"#ccc":"#3F6972",cursor:!o||h?"not-allowed":"pointer",transition:"background-color 0.2s ease"}),onMouseEnter:function(e){e.target.disabled||(e.target.style.background="#2d555e")},onMouseLeave:function(e){e.target.disabled||(e.target.style.background="#3F6972")},children:h?"Fetching...":b&&0===j.length?"Restoring...":"Fetch Repositories"}),(0,d.jsx)("p",{style:u.description,children:"Click this button to fetch your GitHub repositories. Make sure you have entered your Username and PAT above."})]})]}),(0,d.jsxs)("div",{style:{marginTop:"20px"},children:[(0,d.jsx)("label",{htmlFor:"repo",style:u.label,children:"GitHub Repository"}),(0,d.jsxs)("select",{id:"repo",name:"repo",value:T,onChange:Ae,disabled:!o||b,style:Ie(Ie({},u.input),{},{maxWidth:"500px"}),children:[(0,d.jsx)("option",{value:"",children:"Select Repository"}),j.map(function(e){return(0,d.jsx)("option",{value:e.name,children:e.full_name},e.full_name)}),T&&!j.find(function(e){return e.name===T})&&(0,d.jsx)("option",{value:T,selected:!0,children:T})]}),(0,d.jsx)("p",{style:u.description,children:"Click the drop-down and select a repository"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"branch",style:u.label,children:"GitHub Branch"}),(0,d.jsxs)("select",{id:"branch",name:"branch",value:I,onChange:function(e){return A(e.target.value)},disabled:!o||!T||b,style:Ie(Ie({},u.input),{},{maxWidth:"500px"}),children:[(0,d.jsx)("option",{value:"",children:"Select Branch"}),S.map(function(e){return(0,d.jsxs)("option",{value:e.name,children:[e.name," ",e.default?"(Default)":""]},e.name)}),I&&!S.find(function(e){return e.name===I})&&(0,d.jsx)("option",{value:I,selected:!0,children:I})]}),(0,d.jsx)("p",{style:u.description,children:"Click the drop-down and select a branch (Main/Master/Dev branch is selected by default)"})]}),(0,d.jsxs)("div",{style:{marginTop:"30px",paddingTop:"20px",borderTop:"1px solid #e5e5e5"},children:[(0,d.jsxs)("div",{style:{marginTop:"15px",display:"flex",flexWrap:"wrap",gap:"10px"},children:[(0,d.jsx)("button",{type:"button",onClick:Fe,disabled:Be||G,style:Ne("#28a745",G),onMouseEnter:function(e){e.target.disabled||(e.target.style.background="#218838")},onMouseLeave:function(e){e.target.disabled||(e.target.style.background="#28a745")},children:G?"Pulling files...":"Pull Files from GitHub"}),(0,d.jsx)("button",{type:"button",onClick:De,disabled:Be||N,style:Ne("#17a2b8",N),onMouseEnter:function(e){e.target.disabled||(e.target.style.background="#138496")},onMouseLeave:function(e){e.target.disabled||(e.target.style.background="#17a2b8")},children:N?"Checking...":"Check Status"}),(0,d.jsx)("button",{type:"button",onClick:Me,disabled:Be||H,style:Ne("#007cba",H),onMouseEnter:function(e){e.target.disabled||(e.target.style.background="#005a87")},onMouseLeave:function(e){e.target.disabled||(e.target.style.background="#007cba")},children:H?"Pushing...":"Push All Changes to GitHub"}),(0,d.jsx)("button",{type:"button",onClick:function(){var e;ee({title:"Change GitHub Connection",message:"Are you sure you want to change the GitHub connection? This will:<br><br>• Reset your current repository settings<br>• <strong>Remove the ENTIRE GitHub folder</strong> and all its contents<br>• Clear username and token fields<br><br>This action cannot be undone!",confirmText:"Yes, Change Connection & Remove Folder",cancelText:"Cancel",type:"danger",onConfirm:(e=Re(Ee().m(function e(){var t,n,r,o,i,a;return Ee().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,(t=new FormData).append("action","afmp_save_github_settings"),t.append("nonce",c),t.append("ref","reset"),t.append("repo",""),t.append("branch",""),e.n=1,fetch(p,{method:"POST",body:t});case 1:e.n=3;break;case 2:e.p=2,a=e.v,console.error("Error resetting connection:",a);case 3:P(""),A(""),w([]),_([]),Se.current=!1,Y(!1),F(!1),n=document.getElementById("repo"),r=document.getElementById("branch"),n&&(n.value=""),r&&(r.value=""),o=document.getElementById("username"),i=document.getElementById("pat"),o&&(o.value="",o.disabled=!1),i&&(i.value="",i.disabled=!1),s&&(s({type:"success",text:"Connection cleared. Please enter new GitHub Username and PAT, then save changes."}),setTimeout(function(){return s(null)},3e3)),l&&setTimeout(function(){l()},500);case 4:return e.a(2)}},e,null,[[0,2]])})),function(){return e.apply(this,arguments)})}),J(!0)},disabled:!o,style:{padding:"10px 20px",background:o?"#f8d7da":"#ccc",color:o?"#dc3545":"#666",border:o?"1px solid #dc3545":"1px solid #ccc",borderRadius:"4px",fontSize:"14px",fontWeight:600,cursor:o?"pointer":"not-allowed",transition:"background-color 0.2s ease, border-color 0.2s ease",marginRight:"10px"},onMouseEnter:function(e){e.target.disabled||(e.target.style.background="#f5c6cb",e.target.style.borderColor="#c82333")},onMouseLeave:function(e){e.target.disabled||(e.target.style.background="#f8d7da",e.target.style.borderColor="#dc3545")},children:"Change Connection"})]}),!ze&&(0,d.jsx)("p",{style:Ie(Ie({},u.description),{},{marginTop:"12px"}),children:"Select a GitHub repository and branch to enable Pull, Check Status, and Push actions."})]})]}):!R&&(0,d.jsx)("div",{style:{marginTop:"20px",paddingTop:"20px",borderTop:"1px solid #e5e5e5"},children:(0,d.jsx)("div",{style:{background:"#fff3cd",border:"1px solid #ffeaa7",borderLeft:"4px solid #f39c12",padding:"12px",borderRadius:"4px"},children:(0,d.jsx)("p",{style:{margin:0,color:"#856404",fontWeight:600},children:n.username&&f?"GitHub credentials validation failed. Please check your Username and PAT, then save changes again.":"Please enter your GitHub Username and PAT above, then save changes to enable GitHub Actions."})})}),q&&Q&&(0,d.jsx)(me,{isOpen:q,onClose:function(){J(!1),ee(null)},onConfirm:Q.onConfirm,title:Q.title,message:Q.message,confirmText:Q.confirmText,cancelText:Q.cancelText,type:Q.type}),(0,d.jsx)(xe,{isOpen:ne,onClose:function(){return re(!1)},commits:ie,repo:T,branch:I,loading:le}),(0,d.jsx)(Te,{isOpen:de,onClose:function(){pe(!1),he([])},changedFiles:ge,repo:T,branch:I,loading:be,onPush:function(){l&&setTimeout(function(){l()},1e3)},onDiscard:function(){},githubNonce:c,ajaxUrl:p,setMessage:s})]})}function ze(e){return ze="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ze(e)}function Be(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ne(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Be(Object(n),!0).forEach(function(t){Ue(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Be(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ue(e,t,n){return(t=function(e){var t=function(e){if("object"!=ze(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ze(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ze(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Le(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return He(c,"_invoke",function(n,r,o){var i,s,l,c=0,u=o||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return i=t,s=0,l=e,p.n=n,a}};function f(n,r){for(s=n,l=r,t=0;!d&&c&&!o&&t<u.length;t++){var o,i=u[t],f=p.p,g=i[2];n>3?(o=g===r)&&(l=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=f&&((o=n<2&&f<i[1])?(s=0,p.v=r,p.n=i[1]):f<g&&(o=n<3||i[0]>r||r>g)&&(i[4]=n,i[5]=r,p.n=g,s=0))}if(o||n>1)return a;throw d=!0,r}return function(o,u,g){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,g),s=u,l=g;(t=s<2?e:l)||!d;){i||(s?s<3?(s>1&&(p.n=-1),f(s,l)):p.n=l:p.v=l);try{if(c=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(d=p.n<0)?l:n.call(r,p))!==a)break}catch(t){i=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,o,i),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(He(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,He(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,He(d,"constructor",c),He(c,"constructor",l),l.displayName="GeneratorFunction",He(c,o,"GeneratorFunction"),He(d),He(d,o,"Generator"),He(d,r,function(){return this}),He(d,"toString",function(){return"[object Generator]"}),(Le=function(){return{w:i,m:p}})()}function He(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}He=function(e,t,n,r){function i(t,n){He(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},He(e,t,n,r)}function Ve(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function Ke(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Xe(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Xe(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Xe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ye(e){var t=e.settings,n=e.hasPro,o=e.root,i=e.nonce,a=(e.setMessage,e.onApiKeyValidated),s=Ke((0,r.useState)(!1),2),l=s[0],c=s[1],p=Ke((0,r.useState)(!1),2),f=p[0],g=p[1],h=Ke((0,r.useState)(null),2),y=h[0],m=h[1],b=function(){var e,n=(e=Le().m(function e(){var n,r,s,l,c,u,d;return Le().w(function(e){for(;;)switch(e.p=e.n){case 0:if(n=document.getElementById("gpt_api_key"),r=(null==n?void 0:n.value)||t.gpt_api_key||""){e.n=1;break}return m({success:!1,message:"Please enter an API key first."}),e.a(2);case 1:return g(!0),m(null),e.p=2,e.n=3,fetch("".concat(o,"file-manager-advanced/v1/test-api-key"),{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":i},body:JSON.stringify({api_key:r})});case 3:return s=e.v,e.n=4,s.json();case 4:l=e.v,s.ok&&l.success?(m({success:!0,message:"API key is valid!"}),null==a||a()):(u=l.message||(null===(c=l.data)||void 0===c?void 0:c.message)||"API key is invalid",m({success:!1,message:u})),e.n=6;break;case 5:e.p=5,d=e.v,console.error("Error testing API key:",d),m({success:!1,message:"Failed to test API key. Please try again."});case 6:return e.p=6,g(!1),e.f(6);case 7:return e.a(2)}},e,null,[[2,5,6,7]])}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){Ve(i,r,o,a,s,"next",e)}function s(e){Ve(i,r,o,a,s,"throw",e)}a(void 0)})});return function(){return n.apply(this,arguments)}}();return(0,d.jsx)(d.Fragment,{children:(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"gpt_api_key",style:u.label,children:["GPT API Key ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"10px",maxWidth:"560px"},children:[(0,d.jsxs)("div",{style:{position:"relative",flex:1,minWidth:0},children:[(0,d.jsx)("input",{type:l?"text":"password",id:"gpt_api_key",name:"gpt_api_key",defaultValue:t.gpt_api_key||"",disabled:!n,style:Ne(Ne({},u.input),{},{paddingRight:"42px",width:"100%"}),autoComplete:"off"}),(0,d.jsx)("button",{type:"button",onClick:function(){return c(!l)},disabled:!n,style:{position:"absolute",right:"6px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",padding:"6px",cursor:n?"pointer":"not-allowed",display:"flex",alignItems:"center",justifyContent:"center",opacity:n?1:.5,color:"#666"},title:l?"Hide API Key":"Show API Key",children:l?(0,d.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,d.jsx)("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),(0,d.jsx)("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):(0,d.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,d.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})})]}),(0,d.jsx)("button",{type:"button",onClick:b,disabled:!n||f,style:{flexShrink:0,background:f?"#ccc":"#3F6972",color:"#fff",border:"none",borderRadius:"4px",padding:"10px 16px",cursor:!n||f?"not-allowed":"pointer",fontSize:"14px",fontWeight:500,opacity:!n||f?.5:1},children:f?"Testing...":"Test API Key"})]}),y&&(0,d.jsx)("p",{style:Ne(Ne({},u.description),{},{color:y.success?"#28a745":"#dc3545",marginTop:"8px",fontWeight:500}),children:y.message}),(0,d.jsxs)("p",{style:u.description,children:["Enter your OpenAI GPT API key. This key is stored only for your user account."," ",(0,d.jsx)("a",{href:"https://platform.openai.com/api-keys",target:"_blank",rel:"noopener noreferrer",style:u.link,children:"Click here to get your API key"})]})]})})}function $e(e){return $e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$e(e)}function qe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Je(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qe(Object(n),!0).forEach(function(t){Ze(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qe(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ze(e,t,n){return(t=function(e){var t=function(e){if("object"!=$e(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=$e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==$e(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qe(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return et(c,"_invoke",function(n,r,o){var i,s,l,c=0,u=o||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return i=t,s=0,l=e,p.n=n,a}};function f(n,r){for(s=n,l=r,t=0;!d&&c&&!o&&t<u.length;t++){var o,i=u[t],f=p.p,g=i[2];n>3?(o=g===r)&&(l=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=f&&((o=n<2&&f<i[1])?(s=0,p.v=r,p.n=i[1]):f<g&&(o=n<3||i[0]>r||r>g)&&(i[4]=n,i[5]=r,p.n=g,s=0))}if(o||n>1)return a;throw d=!0,r}return function(o,u,g){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,g),s=u,l=g;(t=s<2?e:l)||!d;){i||(s?s<3?(s>1&&(p.n=-1),f(s,l)):p.n=l:p.v=l);try{if(c=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(d=p.n<0)?l:n.call(r,p))!==a)break}catch(t){i=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,o,i),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(et(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,et(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,et(d,"constructor",c),et(c,"constructor",l),l.displayName="GeneratorFunction",et(c,o,"GeneratorFunction"),et(d),et(d,o,"Generator"),et(d,r,function(){return this}),et(d,"toString",function(){return"[object Generator]"}),(Qe=function(){return{w:i,m:p}})()}function et(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}et=function(e,t,n,r){function i(t,n){et(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},et(e,t,n,r)}function tt(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function nt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function rt(e){var t,n,o=e.settings,i=e.hasPro,a=e.root,s=e.nonce,l=e.setMessage,p=e.isConnected,f=e.setShowDisconnectModal,g=e.setDisconnectIntegration,h=(t=(0,r.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,n)||function(e,t){if(e){if("string"==typeof e)return nt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?nt(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),y=h[0],m=h[1],b=c("pcloud",a,s,i),x=b.libraryInstalled,v=b.setLibraryInstalled,j=b.installing,w=b.installLibrary;r.useEffect(function(){void 0!==o.library_installed&&v(o.library_installed)},[o.library_installed,v]);var k=function(){var e,t=(e=Qe().m(function e(){var t;return Qe().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,w();case 1:(t=e.v).success?(l({type:"success",text:t.message}),setTimeout(function(){return l(null)},3e3)):(l({type:"error",text:t.message}),setTimeout(function(){return l(null)},5e3));case 2:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){tt(i,r,o,a,s,"next",e)}function s(e){tt(i,r,o,a,s,"throw",e)}a(void 0)})});return function(){return t.apply(this,arguments)}}(),S=!i||!x,_=o.redirect_uri||"",O=!!(o.app_key&&o.app_secret&&_);return(0,d.jsxs)(d.Fragment,{children:[!x&&(0,d.jsxs)("div",{style:u.warningBox,children:[(0,d.jsx)("p",{style:u.warningText,children:"pCloud library is not installed. Please install the library first."}),(0,d.jsx)("button",{type:"button",onClick:k,disabled:!i||j,style:Je(Je({},u.installButton),{},{background:j?"#ccc":"#3F6972",cursor:!i||j?"not-allowed":"pointer"}),children:j?"Installing Library...":"Install pCloud Library"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"title",style:u.label,children:"Alias"}),(0,d.jsx)("input",{type:"text",id:"title",name:"title",defaultValue:o.title||"pCloud",disabled:S,style:Je(Je({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter a title which will be displayed on File Manager"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"app_key",style:u.label,children:"App Key"}),(0,d.jsx)("input",{type:"text",id:"app_key",name:"app_key",defaultValue:o.app_key||"",disabled:S,style:Je(Je({},u.input),{},{maxWidth:"500px"})}),(0,d.jsxs)("p",{style:u.description,children:["Enter your pCloud App Key."," ",(0,d.jsx)("a",{href:"https://docs.pcloud.com/my_apps/",target:"_blank",rel:"noopener noreferrer",style:u.link,children:"pCloud My Apps"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"app_secret",style:u.label,children:"App Secret"}),(0,d.jsxs)("div",{style:{position:"relative",maxWidth:"500px"},children:[(0,d.jsx)("input",{type:y?"text":"password",id:"app_secret",name:"app_secret",defaultValue:o.app_secret||"",disabled:S,style:u.input}),(0,d.jsx)("button",{type:"button",onClick:function(){return m(!y)},disabled:S,style:{position:"absolute",right:"10px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:S?"not-allowed":"pointer",padding:"5px",display:"flex",alignItems:"center",justifyContent:"center",color:"#666",opacity:S?.5:1},title:y?"Hide App Secret":"Show App Secret",children:y?(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),(0,d.jsx)("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})})]})]}),(0,d.jsx)(Y,{settings:o,disabled:S,description:"Select the user roles allowed to access the pCloud file manager"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"private_folder",style:u.label,children:"Private access folder"}),(0,d.jsx)("input",{type:"text",id:"private_folder",name:"private_folder",defaultValue:o.private_folder||"",disabled:S,style:Je(Je({},u.input),{},{maxWidth:"500px"}),placeholder:"e.g. /Documents"}),(0,d.jsx)("p",{style:u.description,children:"Optional: Enter a folder path to show only that folder. Leave empty to show full pCloud root."})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"redirect_uri",style:u.label,children:"Redirect URI"}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",maxWidth:"500px"},children:[(0,d.jsx)("input",{type:"text",id:"redirect_uri",name:"redirect_uri",value:_,readOnly:!0,disabled:!i,style:Je(Je({},u.input),{},{background:"#f5f5f5"})}),(0,d.jsx)(K,{text:_,disabled:!i,setMessage:l,successMessage:"Redirect URI copied to clipboard!"})]}),(0,d.jsxs)("p",{style:u.description,children:["Copy this URL and paste it in"," ",(0,d.jsx)("strong",{style:u.emphasis,children:"pCloud My Apps → Redirect URI"})]})]}),x&&(0,d.jsx)(F,{serviceName:"pCloud",isConnected:p,canConnect:O,hasPro:i,brandColor:"#2D7FC4",credentialsHint:"Please enter your App Key and App Secret, then save changes before connecting.",onConnect:function(){if(O&&!S){var e=window.location.hash||"#/extension/pcloud";sessionStorage.setItem("afm-oauth-redirect-hash",e);var t="https://my.pcloud.com/oauth2/authorize?client_id=".concat(encodeURIComponent(o.app_key),"&response_type=code&redirect_uri=").concat(encodeURIComponent(_),"&state=").concat(encodeURIComponent(e));window.location.href=t}else l&&(l(_?{type:"error",text:"Please enter App Key and App Secret, then save settings before connecting."}:{type:"error",text:"Redirect URI is missing. Please reload the page and try again."}),setTimeout(function(){return l(null)},4e3))},onDisconnect:function(){g&&f&&(g("pcloud"),f(!0))}})]})}function ot(e){return ot="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ot(e)}function it(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function at(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?it(Object(n),!0).forEach(function(t){st(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):it(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function st(e,t,n){return(t=function(e){var t=function(e){if("object"!=ot(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ot(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ot(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lt(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return ct(c,"_invoke",function(n,r,o){var i,s,l,c=0,u=o||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return i=t,s=0,l=e,p.n=n,a}};function f(n,r){for(s=n,l=r,t=0;!d&&c&&!o&&t<u.length;t++){var o,i=u[t],f=p.p,g=i[2];n>3?(o=g===r)&&(l=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=f&&((o=n<2&&f<i[1])?(s=0,p.v=r,p.n=i[1]):f<g&&(o=n<3||i[0]>r||r>g)&&(i[4]=n,i[5]=r,p.n=g,s=0))}if(o||n>1)return a;throw d=!0,r}return function(o,u,g){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,g),s=u,l=g;(t=s<2?e:l)||!d;){i||(s?s<3?(s>1&&(p.n=-1),f(s,l)):p.n=l:p.v=l);try{if(c=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(d=p.n<0)?l:n.call(r,p))!==a)break}catch(t){i=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,o,i),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(ct(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,ct(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,ct(d,"constructor",c),ct(c,"constructor",l),l.displayName="GeneratorFunction",ct(c,o,"GeneratorFunction"),ct(d),ct(d,o,"Generator"),ct(d,r,function(){return this}),ct(d,"toString",function(){return"[object Generator]"}),(lt=function(){return{w:i,m:p}})()}function ct(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}ct=function(e,t,n,r){function i(t,n){ct(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},ct(e,t,n,r)}function ut(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function dt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function pt(e){var t,n,o=e.settings,i=e.hasPro,a=e.root,s=e.nonce,l=e.setMessage,p=(t=(0,r.useState)(!1),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,n)||function(e,t){if(e){if("string"==typeof e)return dt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?dt(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),f=p[0],g=p[1],h=c("cloudflarer2",a,s,i),y=h.libraryInstalled,m=h.setLibraryInstalled,b=h.installing,x=h.installLibrary;r.useEffect(function(){void 0!==o.library_installed&&m(o.library_installed)},[o.library_installed,m]);var v=function(){var e,t=(e=lt().m(function e(){var t;return lt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,x();case 1:(t=e.v).success?(l({type:"success",text:t.message}),setTimeout(function(){return l(null)},3e3)):(l({type:"error",text:t.message}),setTimeout(function(){return l(null)},5e3));case 2:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){ut(i,r,o,a,s,"next",e)}function s(e){ut(i,r,o,a,s,"throw",e)}a(void 0)})});return function(){return t.apply(this,arguments)}}(),j=!i||!y;return(0,d.jsxs)(d.Fragment,{children:[!y&&(0,d.jsxs)("div",{style:u.warningBox,children:[(0,d.jsx)("p",{style:u.warningText,children:"Cloudflare R2 library is not installed. Please install the library first."}),(0,d.jsx)("button",{type:"button",onClick:v,disabled:!i||b,style:at(at({},u.installButton),{},{background:b?"#ccc":"#3F6972",cursor:!i||b?"not-allowed":"pointer"}),children:b?"Installing Library...":"Install Cloudflare R2 Library"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"title",style:u.label,children:"Alias"}),(0,d.jsx)("input",{type:"text",id:"title",name:"title",defaultValue:o.title||o.alias||"Cloudflare R2",disabled:j,style:at(at({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter a title which will be displayed on File Manager"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"access_key",style:u.label,children:["Access Key ID ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsx)("input",{type:"text",id:"access_key",name:"access_key",defaultValue:o.access_key||"",disabled:j,style:at(at({},u.input),{},{maxWidth:"500px"})}),(0,d.jsxs)("p",{style:u.description,children:["Enter your Cloudflare R2 Access Key ID."," ",(0,d.jsx)("a",{href:"https://dash.cloudflare.com/?to=/:account/r2/api-tokens",target:"_blank",rel:"noopener noreferrer",style:u.link,children:"Manage R2 API Tokens"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"secret_key",style:u.label,children:["Secret Access Key ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsxs)("div",{style:{position:"relative",maxWidth:"500px"},children:[(0,d.jsx)("input",{type:f?"text":"password",id:"secret_key",name:"secret_key",defaultValue:o.secret_key||"",disabled:j,style:u.input}),(0,d.jsx)("button",{type:"button",onClick:function(){return g(!f)},disabled:j,style:{position:"absolute",right:"10px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:j?"not-allowed":"pointer",padding:"5px",display:"flex",alignItems:"center",justifyContent:"center",color:"#666",opacity:j?.5:1},title:f?"Hide Secret Access Key":"Show Secret Access Key",children:f?(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),(0,d.jsx)("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):(0,d.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})})]}),(0,d.jsx)("p",{style:u.description,children:"Enter your Cloudflare R2 Secret Access Key."})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"endpoint",style:u.label,children:["Endpoint URL ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsx)("input",{type:"text",id:"endpoint",name:"endpoint",defaultValue:o.endpoint||"",disabled:j,placeholder:"https://<accountid>.r2.cloudflarestorage.com",style:at(at({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter your R2 Endpoint URL from Cloudflare dashboard."})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"bucket",style:u.label,children:["Bucket Name ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsx)("input",{type:"text",id:"bucket",name:"bucket",defaultValue:o.bucket||"",disabled:j,style:at(at({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter the name of your R2 bucket."})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{style:u.label,children:"User Role Access"}),(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:["editor","author","contributor","subscriber"].map(function(e){return(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,d.jsx)("input",{type:"checkbox",name:"user_role_access",value:e,defaultChecked:Array.isArray(o.user_role_access)&&o.user_role_access.includes(e),disabled:j}),(0,d.jsx)("span",{style:{textTransform:"capitalize"},children:e})]},e)})}),(0,d.jsx)("p",{style:u.description,children:"Select the user roles allowed to access this storage."})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"private_folder",style:u.label,children:"Private Folder Access"}),(0,d.jsx)("input",{type:"text",id:"private_folder",name:"private_folder",defaultValue:o.private_folder||"",disabled:j,style:at(at({},u.input),{},{maxWidth:"500px"}),placeholder:"e.g. Documents"}),(0,d.jsx)("p",{style:u.description,children:"Enter a subfolder name (optional) to restrict access."})]})]})}function ft(e){return ft="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ft(e)}function gt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ht(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?gt(Object(n),!0).forEach(function(t){yt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function yt(e,t,n){return(t=function(e){var t=function(e){if("object"!=ft(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ft(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ft(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mt(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return bt(c,"_invoke",function(n,r,o){var i,s,l,c=0,u=o||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return i=t,s=0,l=e,p.n=n,a}};function f(n,r){for(s=n,l=r,t=0;!d&&c&&!o&&t<u.length;t++){var o,i=u[t],f=p.p,g=i[2];n>3?(o=g===r)&&(l=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=f&&((o=n<2&&f<i[1])?(s=0,p.v=r,p.n=i[1]):f<g&&(o=n<3||i[0]>r||r>g)&&(i[4]=n,i[5]=r,p.n=g,s=0))}if(o||n>1)return a;throw d=!0,r}return function(o,u,g){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,g),s=u,l=g;(t=s<2?e:l)||!d;){i||(s?s<3?(s>1&&(p.n=-1),f(s,l)):p.n=l:p.v=l);try{if(c=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(d=p.n<0)?l:n.call(r,p))!==a)break}catch(t){i=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,o,i),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(bt(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,bt(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,bt(d,"constructor",c),bt(c,"constructor",l),l.displayName="GeneratorFunction",bt(c,o,"GeneratorFunction"),bt(d),bt(d,o,"Generator"),bt(d,r,function(){return this}),bt(d,"toString",function(){return"[object Generator]"}),(mt=function(){return{w:i,m:p}})()}function bt(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}bt=function(e,t,n,r){function i(t,n){bt(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},bt(e,t,n,r)}function xt(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function vt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return jt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?jt(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function jt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var wt=[{value:"us-east-1",label:"US East 1 (N. Virginia)"},{value:"us-east-2",label:"US East 2 (N. Virginia)"},{value:"us-central-1",label:"US Central 1 (Texas)"},{value:"us-west-1",label:"US West 1 (Oregon)"},{value:"us-west-2",label:"US West 2 (San Jose)"},{value:"ca-central-1",label:"CA Central 1 (Toronto)"},{value:"eu-central-1",label:"EU Central 1 (Amsterdam)"},{value:"eu-central-2",label:"EU Central 2 (Frankfurt)"},{value:"eu-west-1",label:"EU West 1 (United Kingdom)"},{value:"eu-west-2",label:"EU West 2 (Paris)"},{value:"eu-west-3",label:"EU West 3 (United Kingdom)"},{value:"eu-south-1",label:"EU South 1 (Milan)"},{value:"ap-northeast-1",label:"AP Northeast 1 (Tokyo)"},{value:"ap-northeast-2",label:"AP Northeast 2 (Osaka)"},{value:"ap-southeast-1",label:"AP Southeast 1 (Singapore)"},{value:"ap-southeast-2",label:"AP Southeast 2 (Sydney)"}];function kt(e){var t=(e||"").trim();return t?"https://s3.".concat(t,".wasabisys.com"):""}function St(e){var t=e.settings,n=e.hasPro,o=e.root,i=e.nonce,a=e.setMessage,s=e.onLibraryInstalled,l=vt((0,r.useState)(!1),2),p=l[0],f=l[1],g=vt((0,r.useState)(t.region||"us-east-1"),2),h=g[0],y=g[1],m=vt((0,r.useState)(t.endpoint||kt(t.region||"us-east-1")),2),b=m[0],x=m[1],v=c("wasabi",o,i,n),j=v.libraryInstalled,w=v.setLibraryInstalled,k=v.installing,S=v.installLibrary;(0,r.useEffect)(function(){void 0!==t.library_installed&&w(t.library_installed)},[t.library_installed,w]),(0,r.useEffect)(function(){var e=t.region||"us-east-1";y(e),x(t.endpoint||kt(e))},[t.region,t.endpoint]);var _=function(){var e,t=(e=mt().m(function e(){var t;return mt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,S();case 1:(t=e.v).success?(w(!0),a({type:"success",text:t.message}),setTimeout(function(){return a(null)},3e3),s&&s()):(a({type:"error",text:t.message}),setTimeout(function(){return a(null)},5e3));case 2:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){xt(i,r,o,a,s,"next",e)}function s(e){xt(i,r,o,a,s,"throw",e)}a(void 0)})});return function(){return t.apply(this,arguments)}}(),O=!n||!j;return(0,d.jsxs)(d.Fragment,{children:[!j&&(0,d.jsxs)("div",{style:u.warningBox,children:[(0,d.jsx)("p",{style:u.warningText,children:"Wasabi uses the same S3 SDK library as Amazon S3 / R2. Install the library to continue."}),(0,d.jsx)("button",{type:"button",onClick:_,disabled:!n||k,style:ht(ht({},u.installButton),{},{background:k?"#ccc":"#3F6972",cursor:!n||k?"not-allowed":"pointer"}),children:k?"Installing Library...":"Install Wasabi Library"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"title",style:u.label,children:"Alias"}),(0,d.jsx)("input",{type:"text",id:"title",name:"title",defaultValue:t.title||t.alias||"Wasabi",disabled:O,style:ht(ht({},u.input),{},{maxWidth:"500px"})}),(0,d.jsx)("p",{style:u.description,children:"Enter a title which will be displayed on File Manager"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"access_key",style:u.label,children:["Access Key ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsx)("input",{type:"text",id:"access_key",name:"access_key",defaultValue:t.access_key||"",disabled:O,style:ht(ht({},u.input),{},{maxWidth:"500px"})}),(0,d.jsxs)("p",{style:u.description,children:["Wasabi access key."," ",(0,d.jsx)("a",{href:"https://console.wasabisys.com/",target:"_blank",rel:"noopener noreferrer",style:u.link,children:"Wasabi console"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"secret_key",style:u.label,children:["Secret Key ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsxs)("div",{style:{position:"relative",maxWidth:"500px"},children:[(0,d.jsx)("input",{type:p?"text":"password",id:"secret_key",name:"secret_key",defaultValue:t.secret_key||"",disabled:O,style:u.input}),(0,d.jsx)("button",{type:"button",onClick:function(){return f(!p)},disabled:O,style:{position:"absolute",right:"10px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",cursor:O?"not-allowed":"pointer",padding:"5px",color:"#666",opacity:O?.5:1},title:p?"Hide secret":"Show secret",children:p?"Hide":"Show"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"wasabi_region_select",style:u.label,children:["Region ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsx)("select",{id:"region",name:"region",value:h,disabled:O,onChange:function(e){var t=e.target.value;y(t),x(kt(t))},style:ht(ht({},u.input),{},{maxWidth:"500px"}),children:wt.map(function(e){return(0,d.jsx)("option",{value:e.value,children:e.label},e.value)})}),(0,d.jsx)("p",{style:u.description,children:"Region where your bucket lives"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"endpoint",style:u.label,children:["Endpoint ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsx)("input",{type:"url",id:"endpoint",name:"endpoint",value:b,readOnly:!0,disabled:O,style:ht(ht({},u.input),{},{maxWidth:"500px",background:"#f5f5f5"})}),(0,d.jsx)("p",{style:u.description,children:"Auto-generated from region (S3 path-style)"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{htmlFor:"bucket",style:u.label,children:["Bucket ",(0,d.jsx)("span",{style:{color:"red"},children:"*"})]}),(0,d.jsx)("input",{type:"text",id:"bucket",name:"bucket",defaultValue:t.bucket||"",disabled:O,style:ht(ht({},u.input),{},{maxWidth:"500px"})})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{style:u.label,children:"User Role Access"}),(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:["editor","author","contributor","subscriber"].map(function(e){return(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,d.jsx)("input",{type:"checkbox",name:"user_role_access",value:e,defaultChecked:Array.isArray(t.user_role_access)&&t.user_role_access.includes(e),disabled:O}),(0,d.jsx)("span",{style:{textTransform:"capitalize"},children:e})]},e)})})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{htmlFor:"private_folder",style:u.label,children:"Private Folder Access"}),(0,d.jsx)("input",{type:"text",id:"private_folder",name:"private_folder",defaultValue:t.private_folder||"",disabled:O,style:ht(ht({},u.input),{},{maxWidth:"500px"}),placeholder:"Optional subfolder prefix"})]})]})}var _t=n(7850),Ot=n(5688),Tt=n(7554);function Pt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Rt(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function Ct(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof s?r:s,c=Object.create(l.prototype);return It(c,"_invoke",function(n,r,o){var i,s,l,c=0,u=o||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return i=t,s=0,l=e,p.n=n,a}};function f(n,r){for(s=n,l=r,t=0;!d&&c&&!o&&t<u.length;t++){var o,i=u[t],f=p.p,g=i[2];n>3?(o=g===r)&&(l=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=f&&((o=n<2&&f<i[1])?(s=0,p.v=r,p.n=i[1]):f<g&&(o=n<3||i[0]>r||r>g)&&(i[4]=n,i[5]=r,p.n=g,s=0))}if(o||n>1)return a;throw d=!0,r}return function(o,u,g){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,g),s=u,l=g;(t=s<2?e:l)||!d;){i||(s?s<3?(s>1&&(p.n=-1),f(s,l)):p.n=l:p.v=l);try{if(c=2,i){if(s||(o="next"),t=i[o]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=e}else if((t=(d=p.n<0)?l:n.call(r,p))!==a)break}catch(t){i=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,o,i),!0),c}var a={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(It(t={},r,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,It(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,It(d,"constructor",c),It(c,"constructor",l),l.displayName="GeneratorFunction",It(c,o,"GeneratorFunction"),It(d),It(d,o,"Generator"),It(d,r,function(){return this}),It(d,"toString",function(){return"[object Generator]"}),(Ct=function(){return{w:i,m:p}})()}function It(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}It=function(e,t,n,r){function i(t,n){It(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},It(e,t,n,r)}function At(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Et(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?At(Object(n),!0).forEach(function(t){Ft(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):At(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ft(e,t,n){return(t=function(e){var t=function(e){if("object"!=zt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=zt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==zt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||Rt(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Rt(e,t){if(e){if("string"==typeof e)return Wt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wt(e,t):void 0}}function Wt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Mt(e,t,n,r,o,i,a){try{var s=e[i](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,o)}function Gt(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){Mt(i,r,o,a,s,"next",e)}function s(e){Mt(i,r,o,a,s,"throw",e)}a(void 0)})}}function zt(e){return zt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zt(e)}function Bt(e){return(0,Ot._H)("file-manager-advanced/v1/".concat(String(e||"").replace(/^\//,"")))}function Nt(e){if(!e||"object"!==zt(e))return null;var t=e.enable;return"yes"===t||!0===t||1===t||"1"===t||"no"!==t&&!1!==t&&0!==t&&"0"!==t&&null}var Ut=new Set(["ai-code-assistent","onedrive","google-drive","dropbox","amazon-s3","github","google-cloud-storage","pcloud","cloudflare-r2","wasabi"]);function Lt(e){var t=e.includes("?")?"&":"?";return"".concat(e).concat(t,"_=").concat(Date.now())}var Ht="Bucket not found. Please check your bucket name.";function Vt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(!e||"string"!=typeof e)return"google-cloud-storage"===t?Ht:"Please check the bucket name and your credentials.";var n=e.trim();if(!n)return"google-cloud-storage"===t?Ht:"Please check the bucket name and your credentials.";if(n.startsWith("{"))try{var r,o=JSON.parse(n);n=(null==o||null===(r=o.error)||void 0===r?void 0:r.message)||(null==o?void 0:o.message)||n}catch(e){}var i=n.toLowerCase();if("google-cloud-storage"===t){if(i.includes("may not exist")||i.includes("does not exist")||i.includes("not found")||i.includes("storage.buckets.get")||i.includes("invalid")&&i.includes("bucket")||i.includes("permission")&&i.includes("denied"))return Ht}else{if(i.includes("not found")||i.includes("does not exist")||i.includes("may not exist"))return Ht;if(i.includes("storage.buckets.get")||i.includes("permission")&&i.includes("denied"))return"Bucket is invalid or inaccessible. Check the bucket name and ensure your service account has Storage permissions.";if(i.includes("invalid")&&i.includes("bucket"))return Ht}return n.length>220?"".concat(n.slice(0,220).trim(),"…"):n}function Kt(e){return Xt.apply(this,arguments)}function Xt(){return Xt=Gt(Ct().m(function e(t){var n,r,o,i,a,s,l,c,u,d,p=arguments;return Ct().w(function(e){for(;;)switch(e.p=e.n){case 0:return n=p.length>1&&void 0!==p[1]?p[1]:{},r=p.length>2&&void 0!==p[2]?p[2]:12e3,o=new AbortController,i=setTimeout(function(){return o.abort()},r),e.p=1,e.n=2,fetch(t,Et(Et({cache:"no-store"},n),{},{signal:o.signal}));case 2:return a=e.v,e.n=3,a.text();case 3:s=e.v,l={};try{l=s?JSON.parse(s):{}}catch(e){l={message:s||"Invalid server response"}}if(a.ok){e.n=4;break}throw d=(null===(c=l)||void 0===c?void 0:c.message)||(null===(u=l)||void 0===u||null===(u=u.data)||void 0===u?void 0:u.message)||"Request failed (".concat(a.status,")"),new Error(d);case 4:return e.a(2,l);case 5:return e.p=5,clearTimeout(i),e.f(5);case 6:return e.a(2)}},e,null,[[1,,5,6]])})),Xt.apply(this,arguments)}function Yt(){var e,t,n,o,i,a,s,l,c,u,p,f,g,h,y,m,b,x,j,w,k,S,_,O,T,C,I,A,E=(0,Ot.lA)(),F=(null===(e=window.wpApiSettings)||void 0===e?void 0:e.nonce)||(null===(t=window.afmReact)||void 0===t?void 0:t.nonce)||"",D=(null===(n=window.afmReact)||void 0===n?void 0:n.hasPro)||!(null===(o=window.afmReact)||void 0===o||!o.proVersion)||!1,R=(null===(i=window.afmReact)||void 0===i?void 0:i.currentPlan)||"free",W=(null===(a=window.afmReact)||void 0===a?void 0:a.pricingUrl)||"https://advancedfilemanager.com/pricing/",M=(0,_t.w)("dropbox",R,D),G=(0,_t.w)("googledrive",R,D),z=(0,_t.w)("onedrive",R,D),B=(0,_t.w)("amazons3",R,D),N=(0,_t.w)("github",R,D),U=(0,_t.w)("googlecloud",R,D),L=(0,_t.w)("pcloud",R,D),H=(0,_t.w)("cloudflarer2",R,D),V=(0,_t.w)("wasabi",R,D),K=(0,_t.w)("digitalocean",R,D),X=(0,_t.w)("ai_integration",R,D),Y=Dt((0,r.useState)({}),2),$=Y[0],q=Y[1],J=Dt((0,r.useState)(!0),2),Z=J[0],Q=J[1],ee=Dt((0,r.useState)(!1),2),te=ee[0],ne=ee[1],oe=Dt((0,r.useState)(!1),2),ie=oe[0],ae=oe[1],se=Dt((0,r.useState)(null),2),le=se[0],ue=se[1],de=Dt((0,r.useState)(null),2),pe=de[0],fe=de[1],ge=Dt((0,r.useState)(!1),2),ye=(ge[0],ge[1],Dt((0,r.useState)(!1),2)),me=(ye[0],ye[1],Dt((0,r.useState)(null),2)),be=(me[0],me[1],Dt((0,r.useState)(!1),2)),xe=be[0],ve=be[1],je=Dt((0,r.useState)(!1),2),we=je[0],ke=je[1],Se=Dt((0,r.useState)(!1),2),_e=Se[0],Oe=Se[1],Te=Dt((0,r.useState)(!1),2),Pe=Te[0],Ce=Te[1],Ie=Dt((0,r.useState)(!1),2),Ae=(Ie[0],Ie[1]),Ee=Dt((0,r.useState)(!1),2),Fe=(Ee[0],Ee[1],Dt((0,r.useState)(!1),2)),De=(Fe[0],Fe[1],Dt((0,r.useState)(!1),2)),Re=De[0],We=De[1],Me=Dt((0,r.useState)(null),2),ze=Me[0],Be=Me[1],Ne=Dt((0,r.useState)(!1),2),Ue=Ne[0],Le=Ne[1],He=Dt((0,r.useState)(0),2),Ve=He[0],Ke=He[1],Xe=(0,r.useRef)({}),$e=(0,r.useRef)(null),qe=(0,r.useRef)([]);(0,r.useEffect)(function(){$e.current=tt},[tt]);var Je=(0,r.useCallback)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={"ai-code-assistent":!!e.ai,onedrive:!!e.onedrive,"google-drive":!!e.googledrive,dropbox:!!e.dropbox,"amazon-s3":!!e.amazonses,github:!!e.github,"google-cloud-storage":!!e.googlecloud,pcloud:!!e.pcloud,"cloudflare-r2":!!e["cloudflare-r2"],wasabi:!!e.wasabi};at(function(e){return e.map(function(e){return Object.prototype.hasOwnProperty.call(t,e.id)?Et(Et({},e),{},{enabled:t[e.id]}):e})})},[]),Ze=(0,r.useCallback)(Gt(Ct().m(function e(){var t,n;return Ct().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,fetch(Bt("integrations-status"),{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":F}});case 1:if(!(t=e.v).ok){e.n=3;break}return e.n=2,t.json();case 2:return n=e.v,Je((null==n?void 0:n.connected)||{}),e.a(2,!0);case 3:e.n=5;break;case 4:e.p=4,e.v;case 5:return e.a(2,!1)}},e,null,[[0,4]])})),[Je,F]),Qe=(0,r.useCallback)(Gt(Ct().m(function e(){var t,n;return Ct().w(function(e){for(;;)switch(e.n){case 0:return t=qe.current.map(function(e){return e.id}).filter(function(e){return Ut.has(e)}),e.n=1,Promise.all(t.map(function(){var e=Gt(Ct().m(function e(t){var n,r,o,i;return Ct().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,n=Bt("integrations/".concat(t)),e.n=1,fetch(n,{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":F}});case 1:if(!(r=e.v).ok){e.n=3;break}return e.n=2,r.json();case 2:return o=e.v,i=Nt(o),e.a(2,{id:t,enabled:!0===i});case 3:return e.a(2,{id:t,enabled:!1});case 4:return e.p=4,e.v,e.a(2,{id:t,enabled:!1})}},e,null,[[0,4]])}));return function(t){return e.apply(this,arguments)}}()));case 1:n=e.v,at(function(e){return e.map(function(e){var t=n.find(function(t){return t.id===e.id});return t?Et(Et({},e),{},{enabled:t.enabled}):e})});case 2:return e.a(2)}},e)})),[F]);(0,r.useEffect)(function(){"ai-code-assistent"!==tt&&Le(!1)},[tt]);var et=Dt((0,r.useState)(function(){return function(){var e=window.location.hash.match(/^#\/extension\/([^\/]+)/);if(e&&e[1]){var t=e[1];if(["ai-code-assistent","onedrive","google-drive","dropbox","amazon-s3","github","google-cloud-storage","pcloud","cloudflare-r2","wasabi","digitalocean"].includes(t))return t}var n=sessionStorage.getItem("afm-extension-integration");return n&&["ai-code-assistent","onedrive","google-drive","dropbox","amazon-s3","github","google-cloud-storage","pcloud","cloudflare-r2","wasabi","digitalocean"].includes(n)?n:null}()}),2),tt=et[0],nt=et[1];(0,r.useEffect)(function(){var e=function(){var e=window.location.hash,t=e.match(/^#\/extension\/([^\/]+)/);if(t&&t[1]){var n=t[1];if(["ai-code-assistent","onedrive","google-drive","dropbox","amazon-s3","github","google-cloud-storage","pcloud","cloudflare-r2","wasabi","digitalocean"].includes(n))return void nt(function(e){return e!==n?n:e})}"true"!==sessionStorage.getItem("afm-extension-hash-just-set")&&("#/extension"!==e&&"#/integrations"!==e||e.match(/^#\/extension\/([^\/]+)/)||nt(function(e){return null!==e?null:e}))},t=setTimeout(e,100);e();var n=setTimeout(e,200);return window.addEventListener("hashchange",e),function(){clearTimeout(t),clearTimeout(n),window.removeEventListener("hashchange",e)}},[]),(0,r.useEffect)(function(){tt?sessionStorage.setItem("afm-extension-integration",tt):sessionStorage.removeItem("afm-extension-integration")},[tt]),(0,r.useEffect)(function(){if("true"!==sessionStorage.getItem("afm-extension-hash-just-set")){var e=setTimeout(function(){if("true"!==sessionStorage.getItem("afm-extension-hash-just-set")){var e=window.location.hash,t=e.match(/^#\/extension\/([^\/]+)/),n=t&&t[1]?t[1]:null,r=n&&["ai-code-assistent","onedrive","google-drive","dropbox","amazon-s3","github","google-cloud-storage","pcloud","cloudflare-r2","wasabi","digitalocean"].includes(n);if(tt||!r)if(tt){var o="#/extension/".concat(tt);if(e!==o){if(n===tt)return;if("true"===sessionStorage.getItem("afm-extension-hash-just-set"))return;if(window.history&&window.history.replaceState){var i=window.location.href.split("#")[0]+o;window.history.replaceState({},"",i)}else window.location.hash=o}}else{if("true"===sessionStorage.getItem("afm-extension-hash-just-set"))return;if(e&&e.startsWith("#/extension/")&&!r){var a="#/extension";if(window.history&&window.history.replaceState){var s=window.location.href.split("#")[0]+a;window.history.replaceState({},"",s)}else window.location.hash=a}}}},500);return function(){return clearTimeout(e)}}},[tt]);var ot=Dt((0,r.useState)([{id:"ai-code-assistent",title:"AI -- Code Pilot",description:"Empower developers with AI-assisted coding, real-time suggestions, and automation inside Advanced File Manager.",iconBg:"#4CAF50",iconColor:"#fff",icon:"image",iconImage:((null===(s=window.afmReact)||void 0===s?void 0:s.pluginUrl)||(null===(l=window.afm_object)||void 0===l?void 0:l.plugin_url)||"/wp-content/plugins/file-manager-advanced/")+"application/assets/images/codepilot.png",enabled:!1,hasSettings:!0,learnMoreUrl:"https://advancedfilemanager.com/integrations/ai-coding-assistant/"},{id:"onedrive",title:"OneDrive",description:"Seamlessly integrate OneDrive to access, organize, and manage your stored files directly through WordPress.",iconBg:"#0078D4",iconColor:"#fff",icon:"image",iconImage:((null===(c=window.afmReact)||void 0===c?void 0:c.pluginUrl)||(null===(u=window.afm_object)||void 0===u?void 0:u.plugin_url)||"/wp-content/plugins/file-manager-advanced/")+"application/assets/images/onedrive.svg",enabled:!1,hasSettings:!0,learnMoreUrl:"https://advancedfilemanager.com/integrations/onedrive/"},{id:"google-drive",title:"Google Drive",description:"Link Google Drive to browse, upload, and manage cloud files from your WordPress file manager.",iconBg:"#4285F4",iconColor:"#fff",icon:"image",iconImage:((null===(p=window.afmReact)||void 0===p?void 0:p.pluginUrl)||(null===(f=window.afm_object)||void 0===f?void 0:f.plugin_url)||"/wp-content/plugins/file-manager-advanced/")+"application/assets/images/googledrive.svg",enabled:!1,hasSettings:!0,learnMoreUrl:"https://advancedfilemanager.com/integrations/google-drive/"},{id:"dropbox",title:"Dropbox",description:"Connect Dropbox to securely upload, manage, and synchronize your files directly within the WordPress dashboard.",iconBg:"#0061FF",iconColor:"#fff",icon:"image",iconImage:((null===(g=window.afmReact)||void 0===g?void 0:g.pluginUrl)||(null===(h=window.afm_object)||void 0===h?void 0:h.plugin_url)||"/wp-content/plugins/file-manager-advanced/")+"application/assets/images/dropbox.svg",enabled:!1,hasSettings:!0,learnMoreUrl:"https://advancedfilemanager.com/integrations/dropbox/"},{id:"amazon-s3",title:"Amazon S3",description:"Connect Amazon S3 for scalable file storage, secure uploads, and efficient access within WordPress.",iconBg:"#FF9900",iconColor:"#fff",icon:"image",iconImage:((null===(y=window.afmReact)||void 0===y?void 0:y.pluginUrl)||(null===(m=window.afm_object)||void 0===m?void 0:m.plugin_url)||"/wp-content/plugins/file-manager-advanced/")+"application/assets/images/amazons3.svg",enabled:!1,hasSettings:!0,learnMoreUrl:"https://advancedfilemanager.com/integrations/amazon-s3/"},{id:"github",title:"Github",description:"Integrate GitHub to browse repositories, edit files, and sync development projects directly through WordPress.",iconBg:"#181717",iconColor:"#fff",icon:"image",iconImage:((null===(b=window.afmReact)||void 0===b?void 0:b.pluginUrl)||(null===(x=window.afm_object)||void 0===x?void 0:x.plugin_url)||"/wp-content/plugins/file-manager-advanced/")+"application/assets/images/github.svg",enabled:!1,hasSettings:!0,learnMoreUrl:"https://advancedfilemanager.com/integrations/github-integration-for-wordpress-advanced-file-manager/"},{id:"google-cloud-storage",title:"Google Cloud Storage",description:"Enable Google Cloud for secure storage, direct uploads, and high-performance file management in WordPress.",iconBg:"#4285F4",iconColor:"#fff",icon:"image",iconImage:((null===(j=window.afmReact)||void 0===j?void 0:j.pluginUrl)||(null===(w=window.afm_object)||void 0===w?void 0:w.plugin_url)||"/wp-content/plugins/file-manager-advanced/")+"application/assets/images/googlecloud.svg",enabled:!1,hasSettings:!0,learnMoreUrl:"https://advancedfilemanager.com/integrations/google-cloud-storage/"},{id:"pcloud",title:"pCloud",description:"Connect and manage your pCloud files directly from the Advanced File Manager.",iconBg:"#2D7FC4",iconColor:"#fff",icon:"image",iconImage:((null===(k=window.afmReact)||void 0===k?void 0:k.pluginUrl)||(null===(S=window.afm_object)||void 0===S?void 0:S.plugin_url)||"/wp-content/plugins/file-manager-advanced/")+"application/assets/images/pcloud.svg",enabled:!1,hasSettings:!0,learnMoreUrl:"https://advancedfilemanager.com/integrations/pcloud/"},{id:"cloudflare-r2",title:"Cloudflare R2",description:"Connect and manage your Cloudflare R2 buckets/files directly from the Advanced File Manager.",iconBg:"#F38020",iconColor:"#fff",icon:"image",iconImage:((null===(_=window.afmReact)||void 0===_?void 0:_.pluginUrl)||(null===(O=window.afm_object)||void 0===O?void 0:O.plugin_url)||"/wp-content/plugins/file-manager-advanced/")+"application/assets/images/cloudflarer2.svg",enabled:!1,hasSettings:!0,learnMoreUrl:"https://advancedfilemanager.com/integrations/cloudflare-r2/"},{id:"wasabi",title:"Wasabi",description:"Connect Wasabi hot cloud storage (S3-compatible) to browse and manage buckets from the file manager.",iconBg:"#00ce3e",iconColor:"#fff",icon:"image",iconImage:((null===(T=window.afmReact)||void 0===T?void 0:T.pluginUrl)||(null===(C=window.afm_object)||void 0===C?void 0:C.plugin_url)||"/wp-content/plugins/file-manager-advanced/")+"application/assets/images/wasabi.svg",enabled:!1,hasSettings:!0,learnMoreUrl:"https://advancedfilemanager.com/integrations/wasabi/"},{id:"digitalocean",title:"DigitalOcean Spaces",description:"Connect and manage your DigitalOcean Spaces buckets/files directly from the Advanced File Manager.",iconBg:"#0080FF",iconColor:"#fff",icon:"image",iconImage:((null===(I=window.afmReact)||void 0===I?void 0:I.pluginUrl)||(null===(A=window.afm_object)||void 0===A?void 0:A.plugin_url)||"/wp-content/plugins/file-manager-advanced/")+"application/assets/images/digitalocean.svg",enabled:!1,hasSettings:!0,comingSoon:!0,learnMoreUrl:"https://advancedfilemanager.com/integrations/digitalocean/"}]),2),it=ot[0],at=ot[1];(0,r.useEffect)(function(){qe.current=it},[it]);var st=function(e){e.id;var t=e.checked,n=e.disabled,r=e.onChange;return(0,d.jsx)("label",{onClick:function(e){!n&&r&&(e.preventDefault(),e.stopPropagation(),r({target:{checked:!t}}))},style:{display:"inline-flex",alignItems:"center",cursor:n?"not-allowed":"pointer",opacity:n?.5:1,margin:0,padding:0,userSelect:"none"},children:(0,d.jsx)("div",{style:{position:"relative",width:"44px",height:"24px",background:t?"#3F6972":"#ccc",borderRadius:"12px",transition:"background 0.3s",pointerEvents:n?"none":"auto"},children:(0,d.jsx)("div",{style:{position:"absolute",top:"2px",left:t?"22px":"2px",width:"20px",height:"20px",background:"#fff",borderRadius:"50%",transition:"left 0.3s",boxShadow:"0 2px 4px rgba(0,0,0,0.2)"}})})})},lt=function(e){if(!D)return alert("Pro version is required for integrations."),Promise.resolve();var t=it.find(function(t){return t.id===e});if(!t)return Promise.resolve();var n=!t.enabled,r=Bt("integrations/".concat(e)),o={enable:n?"yes":"no"};at(function(t){var r=t.map(function(t){return t.id===e?Et(Et({},t),{},{enabled:n}):t});return qe.current=r,r});var i=Gt(Ct().m(function i(){var a,s,l;return Ct().w(function(i){for(;;)switch(i.n){case 0:return i.n=1,fetch(r,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":F},body:JSON.stringify(o)});case 1:return a=i.v,i.n=2,a.json();case 2:if(s=i.v,a.ok&&s.success){i.n=3;break}throw at(function(t){return t.map(function(t){return t.id===e?Et(Et({},t),{},{enabled:!n}):t})}),ue({type:"error",text:s.message||"Failed to save toggle state"}),setTimeout(function(){return ue(null)},3e3),new Error(s.message||"Failed to save toggle state");case 3:return at(function(t){var r=t.map(function(t){return t.id===e?Et(Et({},t),{},{enabled:n}):t});return qe.current=r,r}),$e.current===e&&(l=s.settings||o,q(Et(Et({},l),{},{enable:n?"yes":"no"}))),ue({type:"success",text:s.message||"".concat(t.title," ").concat(n?"enabled":"disabled"," successfully")}),setTimeout(function(){return ue(null)},3e3),"ai-code-assistent"===e&&sessionStorage.setItem("afm_ai_settings_changed","true"),i.a(2,n)}},i)}))();return Xe.current[e]=i,i.finally(function(){Xe.current[e]===i&&delete Xe.current[e]}),i.catch(function(t){"Failed to save toggle state"!==(null==t?void 0:t.message)&&(console.error("Error saving toggle state:",t),at(function(t){return t.map(function(t){return t.id===e?Et(Et({},t),{},{enabled:!n}):t})}),ue({type:"error",text:"Failed to save toggle state"}),setTimeout(function(){return ue(null)},3e3))})};(0,r.useEffect)(function(){var e=function(){var e=Gt(Ct().m(function e(){return Ct().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,Ze();case 1:if(e.v){e.n=2;break}return e.n=2,Qe();case 2:e.n=4;break;case 3:e.p=3,e.v;case 4:return e.p=4,Q(!1),e.f(4);case 5:return e.a(2)}},e,null,[[0,3,4,5]])}));return function(){return e.apply(this,arguments)}}();e()},[Ze,Qe]);var ct=r.useCallback(function(){tt&&D&&Kt(Bt("integrations/".concat(tt)),{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":F}}).then(function(e){q(e||{})}).catch(function(e){console.error("Error refreshing integration settings:",e)})},[tt,D,E,F]);(0,r.useEffect)(function(){if(tt&&D){var e=!1,t=function(){var t=Gt(Ct().m(function t(){var n,r,o,i,a,s,l;return Ct().w(function(t){for(;;)switch(t.p=t.n){case 0:if(ne(!0),!(r=Xe.current[tt])){t.n=4;break}return t.p=1,t.n=2,r;case 2:n=t.v,t.n=4;break;case 3:t.p=3,t.v;case 4:if(!e){t.n=5;break}return t.a(2);case 5:return o=Bt("integrations/".concat(tt)),t.p=6,t.n=7,Kt(Lt(o),{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":F}});case 7:if(i=t.v,!e){t.n=8;break}return t.a(2);case 8:a=Nt(i),at(function(e){return e.map(function(e){return e.id!==tt?e:"boolean"==typeof n?Et(Et({},e),{},{enabled:n}):null!==a?Et(Et({},e),{},{enabled:a}):e})}),s="boolean"==typeof n?n:null!==a?a:void 0,q(Et(Et({},i||{}),"boolean"==typeof s?{enable:s?"yes":"no"}:{})),Ke(function(e){return e+1}),"onedrive"===tt&&void 0!==i.is_connected&&ve(i.is_connected),"google-drive"===tt&&void 0!==i.is_connected&&(Ce(i.is_connected),i.error_message&&(ue({type:"error",text:i.error_message}),setTimeout(function(){return ue(null)},5e3))),"dropbox"===tt&&(void 0!==i.is_connected&&ke(i.is_connected),void 0!==i.library_installed?Ae(i.library_installed):Ae(!1),i.error_message&&(ue({type:"error",text:i.error_message}),setTimeout(function(){return ue(null)},5e3))),"pcloud"===tt&&void 0!==i.is_connected&&Oe(i.is_connected),t.n=10;break;case 9:t.p=9,l=t.v,e||(console.error("Error fetching integration settings:",l),ue({type:"error",text:"Failed to load ".concat(tt," settings. ").concat(l.message||"").trim()}),setTimeout(function(){return ue(null)},5e3));case 10:return t.p=10,e||ne(!1),t.f(10);case 11:return t.a(2)}},t,null,[[6,9,10,11],[1,3]])}));return function(){return t.apply(this,arguments)}}();return t(),function(){e=!0}}},[tt,D,E,F]),(0,r.useEffect)(function(){var e=new URLSearchParams(window.location.search),t=e.get("dropbox_connected"),n=e.get("dropbox_disconnected"),r=e.get("dropbox_error"),o=e.get("onedrive_connected"),i=e.get("onedrive_disconnected"),a=e.get("onedrive_error"),s=e.get("googledrive_connected"),l=e.get("googledrive_disconnected"),c=e.get("googledrive_error"),u=e.get("error_msg"),d=e.get("redirect_hash");if(t||(t=sessionStorage.getItem("afm-dropbox-connected")),n||(n=sessionStorage.getItem("afm-dropbox-disconnected")),r||(r=sessionStorage.getItem("afm-dropbox-error")),o||(o=sessionStorage.getItem("afm-onedrive-connected")),i||(i=sessionStorage.getItem("afm-onedrive-disconnected")),a||(a=sessionStorage.getItem("afm-onedrive-error")),s||(s=sessionStorage.getItem("afm-googledrive-connected")),l||(l=sessionStorage.getItem("afm-googledrive-disconnected")),c||(c=sessionStorage.getItem("afm-googledrive-error")),u||(u=sessionStorage.getItem("afm-dropbox-error-msg")||sessionStorage.getItem("afm-onedrive-error-msg")||sessionStorage.getItem("afm-googledrive-error-msg")),d||(d=sessionStorage.getItem("afm-oauth-redirect-hash")),"1"===r){if(nt("dropbox"),u){var p=decodeURIComponent(u);ue({type:"error",text:p}),setTimeout(function(){ue(null)},5e3)}else ue({type:"error",text:"Dropbox connection failed. Please check your credentials."}),setTimeout(function(){return ue(null)},5e3);return setTimeout(function(){var t=d||"#/extension/dropbox",n=e.get("page")||"file_manager_advanced_ui",r=window.location.pathname+"?page="+encodeURIComponent(n)+t;window.history.replaceState({},"",r),sessionStorage.setItem("afm-should-restore-tab","true"),sessionStorage.setItem("afm-active-tab","extension"),sessionStorage.setItem("afm-extension-integration","dropbox")},200),sessionStorage.removeItem("afm-dropbox-error"),sessionStorage.removeItem("afm-dropbox-error-msg"),void sessionStorage.removeItem("afm-oauth-redirect-hash")}if("1"===t&&(console.log("Setting Dropbox connected message"),ue({type:"success",text:"Dropbox connected successfully!"}),setTimeout(function(){console.log("Clearing Dropbox connected message"),ue(null)},5e3),nt("dropbox"),ke(!0),setTimeout(function(){sessionStorage.setItem("afm-extension-hash-just-set","true");var t=d||"#/extension/dropbox",n=e.get("page")||"file_manager_advanced_ui",r=window.location.pathname+"?page="+encodeURIComponent(n)+t;window.history.replaceState({},"",r),sessionStorage.setItem("afm-should-restore-tab","true"),sessionStorage.setItem("afm-active-tab","extension"),sessionStorage.setItem("afm-extension-integration","dropbox"),setTimeout(function(){sessionStorage.removeItem("afm-extension-hash-just-set")},1e3)},200),sessionStorage.removeItem("afm-dropbox-connected"),sessionStorage.removeItem("afm-oauth-redirect-hash")),"1"===n&&(console.log("Setting Dropbox disconnected message"),ue({type:"success",text:"Dropbox disconnected successfully!"}),setTimeout(function(){console.log("Clearing Dropbox disconnected message"),ue(null)},5e3),nt("dropbox"),ke(!1),setTimeout(function(){sessionStorage.setItem("afm-extension-hash-just-set","true");var t=d||"#/extension/dropbox",n=e.get("page")||"file_manager_advanced_ui",r=window.location.pathname+"?page="+encodeURIComponent(n)+t;window.history.replaceState({},"",r),sessionStorage.setItem("afm-should-restore-tab","true"),sessionStorage.setItem("afm-active-tab","extension"),sessionStorage.setItem("afm-extension-integration","dropbox"),setTimeout(function(){sessionStorage.removeItem("afm-extension-hash-just-set")},1e3)},200),sessionStorage.removeItem("afm-dropbox-disconnected"),sessionStorage.removeItem("afm-oauth-redirect-hash")),"1"===a){if(console.log("Setting OneDrive error message"),nt("onedrive"),u){var f=decodeURIComponent(u);console.log("Error message:",f),ue({type:"error",text:f}),setTimeout(function(){console.log("Clearing OneDrive error message"),ue(null)},5e3)}else ue({type:"error",text:"OneDrive connection failed. Please check your credentials."}),setTimeout(function(){return ue(null)},5e3);return setTimeout(function(){var t=d||"#/extension/onedrive",n=e.get("page")||"file_manager_advanced_ui",r=window.location.pathname+"?page="+encodeURIComponent(n)+t;window.history.replaceState({},"",r),sessionStorage.setItem("afm-should-restore-tab","true"),sessionStorage.setItem("afm-active-tab","extension"),sessionStorage.setItem("afm-extension-integration","onedrive")},200),sessionStorage.removeItem("afm-onedrive-error"),sessionStorage.removeItem("afm-onedrive-error-msg"),void sessionStorage.removeItem("afm-oauth-redirect-hash")}if("1"===o&&(console.log("Setting OneDrive connected message"),ue({type:"success",text:"OneDrive connected successfully!"}),setTimeout(function(){console.log("Clearing OneDrive connected message"),ue(null)},5e3),nt("onedrive"),ve(!0),setTimeout(function(){sessionStorage.setItem("afm-extension-hash-just-set","true");var t=d||"#/extension/onedrive",n=e.get("page")||"file_manager_advanced_ui",r=window.location.pathname+"?page="+encodeURIComponent(n)+t;window.history.replaceState({},"",r),sessionStorage.setItem("afm-should-restore-tab","true"),sessionStorage.setItem("afm-active-tab","extension"),sessionStorage.setItem("afm-extension-integration","onedrive"),setTimeout(function(){sessionStorage.removeItem("afm-extension-hash-just-set")},1e3)},200),sessionStorage.removeItem("afm-onedrive-connected"),sessionStorage.removeItem("afm-oauth-redirect-hash")),"1"===i&&(console.log("Setting OneDrive disconnected message"),ue({type:"success",text:"OneDrive disconnected successfully!"}),setTimeout(function(){console.log("Clearing OneDrive disconnected message"),ue(null)},5e3),nt("onedrive"),ve(!1),setTimeout(function(){sessionStorage.setItem("afm-extension-hash-just-set","true");var t=d||"#/extension/onedrive",n=e.get("page")||"file_manager_advanced_ui",r=window.location.pathname+"?page="+encodeURIComponent(n)+t;window.history.replaceState({},"",r),sessionStorage.setItem("afm-should-restore-tab","true"),sessionStorage.setItem("afm-active-tab","extension"),sessionStorage.setItem("afm-extension-integration","onedrive"),setTimeout(function(){sessionStorage.removeItem("afm-extension-hash-just-set")},1e3)},200),sessionStorage.removeItem("afm-onedrive-disconnected"),sessionStorage.removeItem("afm-oauth-redirect-hash")),"1"===c){if(console.log("Setting Google Drive error message"),nt("google-drive"),u){var g=decodeURIComponent(u);console.log("Error message:",g),ue({type:"error",text:g}),setTimeout(function(){console.log("Clearing Google Drive error message"),ue(null)},5e3)}else ue({type:"error",text:"Google Drive connection failed. Please check your credentials."}),setTimeout(function(){return ue(null)},5e3);return setTimeout(function(){sessionStorage.setItem("afm-extension-hash-just-set","true");var t=d||"#/extension/google-drive",n=e.get("page")||"file_manager_advanced_ui",r=window.location.pathname+"?page="+encodeURIComponent(n)+t;window.history.replaceState({},"",r),sessionStorage.setItem("afm-should-restore-tab","true"),sessionStorage.setItem("afm-active-tab","extension"),sessionStorage.setItem("afm-extension-integration","google-drive"),setTimeout(function(){sessionStorage.removeItem("afm-extension-hash-just-set")},1e3)},200),sessionStorage.removeItem("afm-googledrive-error"),sessionStorage.removeItem("afm-googledrive-error-msg"),void sessionStorage.removeItem("afm-oauth-redirect-hash")}"1"===s&&(console.log("Setting Google Drive connected message"),ue({type:"success",text:"Google Drive connected successfully!"}),setTimeout(function(){console.log("Clearing Google Drive connected message"),ue(null)},5e3),nt("google-drive"),Ce(!0),setTimeout(function(){sessionStorage.setItem("afm-extension-hash-just-set","true");var t=d||"#/extension/google-drive",n=e.get("page")||"file_manager_advanced_ui",r=window.location.pathname+"?page="+encodeURIComponent(n)+t;window.history.replaceState({},"",r),sessionStorage.setItem("afm-should-restore-tab","true"),sessionStorage.setItem("afm-active-tab","extension"),sessionStorage.setItem("afm-extension-integration","google-drive"),setTimeout(function(){sessionStorage.removeItem("afm-extension-hash-just-set")},1e3)},200),sessionStorage.removeItem("afm-googledrive-connected"),sessionStorage.removeItem("afm-oauth-redirect-hash")),"1"===l&&(console.log("Setting Google Drive disconnected message"),ue({type:"success",text:"Google Drive disconnected successfully!"}),setTimeout(function(){console.log("Clearing Google Drive disconnected message"),ue(null)},5e3),nt("google-drive"),Ce(!1),setTimeout(function(){sessionStorage.setItem("afm-extension-hash-just-set","true");var t=d||"#/extension/google-drive",n=e.get("page")||"file_manager_advanced_ui",r=window.location.pathname+"?page="+encodeURIComponent(n)+t;window.history.replaceState({},"",r),sessionStorage.setItem("afm-should-restore-tab","true"),sessionStorage.setItem("afm-active-tab","extension"),sessionStorage.setItem("afm-extension-integration","google-drive"),setTimeout(function(){sessionStorage.removeItem("afm-extension-hash-just-set")},1e3)},200),sessionStorage.removeItem("afm-googledrive-disconnected"),sessionStorage.removeItem("afm-oauth-redirect-hash"))},[]),(0,r.useEffect)(function(){var e=new URLSearchParams(window.location.search),t=e.get("onedrive_connected"),n=e.get("onedrive_disconnected"),r=e.get("googledrive_connected"),o=e.get("googledrive_disconnected"),i=e.get("dropbox_connected"),a=e.get("dropbox_disconnected"),s=e.get("dropbox_error"),l=e.get("pcloud_connected"),c=e.get("pcloud_disconnected"),u=e.get("pcloud_error"),d=e.get("error_msg"),p=e.get("redirect_hash");if(p){var f=e.get("page")||"file_manager_advanced_ui",g=p;p.includes("onedrive")?(p.startsWith("#/extension/")||(g="#/extension/onedrive"),nt("onedrive")):p.includes("googledrive")||p.includes("google-drive")?(p.startsWith("#/extension/")||(g="#/extension/google-drive"),nt("google-drive")):p.includes("dropbox")&&(p.startsWith("#/extension/")||(g="#/extension/dropbox"),nt("dropbox"));var h=window.location.pathname;h+="?page="+encodeURIComponent(f),h+=g,window.history.replaceState({},"",h)}if("1"===t){"onedrive"!==tt&&nt("onedrive"),ve(!0),ue({type:"success",text:"OneDrive connected successfully!"}),setTimeout(function(){return ue(null)},3e3);var y=p||"#/extension/onedrive",m=e.get("page")||"file_manager_advanced_ui",b=window.location.pathname+"?page="+encodeURIComponent(m)+y;window.history.replaceState({},"",b)}if("1"===n){"onedrive"!==tt&&nt("onedrive"),ve(!1),ue({type:"success",text:"OneDrive disconnected successfully!"}),setTimeout(function(){return ue(null)},3e3);var x=p||"#/extension/onedrive",v=e.get("page")||"file_manager_advanced_ui",j=window.location.pathname+"?page="+encodeURIComponent(v)+x;window.history.replaceState({},"",j)}if("1"===i||"1"===a){var w=p||"#/extension/dropbox",k=e.get("page")||"file_manager_advanced_ui",S=window.location.pathname+"?page="+encodeURIComponent(k)+w;window.history.replaceState({},"",S)}if("1"===l){"pcloud"!==tt&&nt("pcloud"),Oe(!0),ue({type:"success",text:"pCloud connected successfully!"}),setTimeout(function(){return ue(null)},3e3);var _=p||"#/extension/pcloud",O=e.get("page")||"file_manager_advanced_ui",T=window.location.pathname+"?page="+encodeURIComponent(O)+_;window.history.replaceState({},"",T)}if("1"===c){"pcloud"!==tt&&nt("pcloud"),Oe(!1),ue({type:"success",text:"pCloud disconnected successfully!"}),setTimeout(function(){return ue(null)},3e3);var P=p||"#/extension/pcloud",C=e.get("page")||"file_manager_advanced_ui",I=window.location.pathname+"?page="+encodeURIComponent(C)+P;window.history.replaceState({},"",I)}if("1"===u){"pcloud"!==tt&&nt("pcloud"),d&&(ue({type:"error",text:decodeURIComponent(d)}),setTimeout(function(){return ue(null)},5e3));var A=p||"#/extension/pcloud",E=e.get("page")||"file_manager_advanced_ui",F=window.location.pathname+"?page="+encodeURIComponent(E)+A;window.history.replaceState({},"",F)}if("1"!==s||r||o||null!=p&&p.includes("google")){if("1"===s){var D=p||window.location.hash||"#/extension",R=e.get("page")||"file_manager_advanced_ui",W=window.location.pathname+"?page="+encodeURIComponent(R)+D;window.history.replaceState({},"",W)}}else{"dropbox"!==tt&&nt("dropbox"),d&&(ue({type:"error",text:decodeURIComponent(d)}),setTimeout(function(){return ue(null)},5e3));var M=p||"#/extension/dropbox",G=e.get("page")||"file_manager_advanced_ui",z=window.location.pathname+"?page="+encodeURIComponent(G)+M;window.history.replaceState({},"",z)}},[tt]);var ut=function(){var e=Gt(Ct().m(function e(t){var n,r,o,i,a,s,l;return Ct().w(function(e){for(;;)switch(e.p=e.n){case 0:if(D){e.n=1;break}return alert("Pro version is required for integrations."),e.a(2);case 1:if(console.log("handleSettings called with id:",t),!(r=Xe.current[t])){e.n=5;break}return e.p=2,e.n=3,r;case 3:n=e.v,e.n=5;break;case 4:e.p=4,e.v;case 5:o=qe.current.find(function(e){return e.id===t}),i="boolean"==typeof n?n:!(null==o||!o.enabled),sessionStorage.setItem("afm-extension-integration",t),console.log("Saved to sessionStorage:",t),sessionStorage.setItem("afm-extension-hash-just-set","true"),setTimeout(function(){sessionStorage.removeItem("afm-extension-hash-just-set")},2e3),nt(t),q({enable:i?"yes":"no"}),a="#/extension/".concat(t),s=window.location.href.split("#")[0],l=s+a,console.log("Setting hash to:",a,"Full URL:",l),window.history&&window.history.replaceState?(window.history.replaceState({},"",l),console.log("Hash set via replaceState")):(window.location.hash=a,console.log("Hash set via location.hash")),setTimeout(function(){var e=window.location.hash;console.log("Hash verification after 50ms:",e),e!==a&&(console.warn("Hash mismatch! Expected:",a,"Got:",e),window.history&&window.history.replaceState?window.history.replaceState({},"",l):window.location.hash=a)},50),setTimeout(function(){var e=window.location.hash;console.log("Hash verification after 150ms:",e),e!==a&&(console.warn("Hash mismatch! Expected:",a,"Got:",e),window.history&&window.history.replaceState?window.history.replaceState({},"",l):window.location.hash=a)},150),setTimeout(function(){var e=window.location.hash;console.log("Hash verification after 300ms:",e),e!==a&&(console.warn("Hash mismatch! Expected:",a,"Got:",e),window.history&&window.history.replaceState?window.history.replaceState({},"",l):window.location.hash=a)},300);case 6:return e.a(2)}},e,null,[[2,4]])}));return function(t){return e.apply(this,arguments)}}(),dt=function(){var e=Gt(Ct().m(function e(t){var n,r,o,i,a,s,l,c,u,d,p,f,g,h,y,m,b,x,v,j,w,k,S,_,O,T,P,C,I,A,E,R,W,M,G,z,B,N,U,L,H,V,K,X,Y,J,Z,Q,ee,te,ne,re,oe,ie,se,le,ce,de,fe,ge,he,ye,me,be,xe,je,we,ke,Se,_e,Oe,Te,Pe,Ie,Ae,Ee,Fe,De,Re,We,Me,Ge,ze,Be,Ne,Ue,Le,He,Ve,Xe,Ye,$e,Je,Ze,Qe,et,nt,rt;return Ct().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t.preventDefault(),D&&tt){e.n=1;break}return e.a(2);case 1:if(null!=(n=qe.current.find(function(e){return e.id===tt}))&&n.enabled){e.n=2;break}return ue({type:"error",text:"Please enable this integration first before saving settings."}),setTimeout(function(){return ue(null)},5e3),e.a(2);case 2:if(ae(!0),ue(null),r=new FormData(t.target),o={},"amazon-s3"!==tt){e.n=13;break}if($.library_installed){e.n=3;break}return ue({type:"error",text:"Please install Amazon S3 library first before saving settings."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 3:if(i=document.getElementById("bucket"),a=document.getElementById("app_key"),s=document.getElementById("app_secret"),l=document.getElementById("region"),i&&a&&s&&l){e.n=4;break}return ue({type:"error",text:"Required input fields not found. Please refresh the page."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 4:if(c=(i.value||"").trim(),u=(a.value||"").trim(),d=(s.value||"").trim(),p=(l.value||"").trim(),c&&0!==c.length){e.n=5;break}return ue({type:"error",text:"Please enter your Amazon S3 Bucket Name."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 5:if(u&&0!==u.length){e.n=6;break}return ue({type:"error",text:"Please enter your Amazon S3 App Key."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 6:if(d&&0!==d.length){e.n=7;break}return ue({type:"error",text:"Please enter your Amazon S3 App Secret."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 7:if(p&&0!==p.length){e.n=8;break}return ue({type:"error",text:"Please enter your AWS Region."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 8:if(!(c.length<3||c.length>63)){e.n=9;break}return ue({type:"error",text:"Bucket name must be between 3 and 63 characters long."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 9:if(/^[a-z0-9][a-z0-9.-]*[a-z0-9]$/.test(c)||/^[a-z0-9]$/.test(c)){e.n=10;break}return ue({type:"error",text:"Bucket name format is invalid. Use lowercase letters, numbers, dots, and hyphens. Must start and end with a letter or number."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 10:if(!(u.length<10)){e.n=11;break}return ue({type:"error",text:"App Key appears to be too short. Please check your AWS Access Key ID."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 11:if(!(d.length<20)){e.n=12;break}return ue({type:"error",text:"App Secret appears to be too short. Please check your AWS Secret Access Key."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 12:if(!(p.length<2)){e.n=13;break}return ue({type:"error",text:"Region appears to be invalid. Please check your AWS Region."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 13:if("wasabi"!==tt){e.n=18;break}if($.library_installed){e.n=14;break}return ue({type:"error",text:"Please install the Wasabi library first (same SDK as S3)."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 14:if(f=document.getElementById("bucket"),g=document.getElementById("access_key"),h=document.getElementById("secret_key"),y=document.getElementById("region"),m=document.getElementById("endpoint"),f&&g&&h&&y&&m){e.n=15;break}return ue({type:"error",text:"Required Wasabi fields not found. Please refresh the page."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 15:if(b=(f.value||"").trim(),x=(g.value||"").trim(),v=(h.value||"").trim(),j=(y.value||"").trim(),w=(m.value||"").trim(),b&&x&&v&&j&&w){e.n=16;break}return ue({type:"error",text:"Please fill Access Key, Secret Key, Region, Endpoint, and Bucket for Wasabi."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 16:if(!(b.length<3||b.length>63)){e.n=17;break}return ue({type:"error",text:"Bucket name must be between 3 and 63 characters long."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 17:if(/^[a-z0-9][a-z0-9.-]*[a-z0-9]$/.test(b)||/^[a-z0-9]$/.test(b)){e.n=18;break}return ue({type:"error",text:"Bucket name format is invalid for Wasabi (S3 rules)."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 18:if("google-cloud-storage"!==tt){e.n=38;break}if($.library_installed){e.n=19;break}return ue({type:"error",text:"Please install Google Cloud library first before saving settings."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 19:if(k=document.getElementById("bucket")){e.n=20;break}return ue({type:"error",text:"Bucket input field not found. Please refresh the page."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 20:if(S=k.value||"",(_=S.trim())&&0!==_.length){e.n=21;break}return ue({type:"error",text:"Please enter your Google Cloud Bucket Name."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 21:if(1===_.length?/^[a-z0-9]$/.test(_):2===_.length?/^[a-z0-9][a-z0-9]$/.test(_):/^[a-z0-9][a-z0-9\-_.]*[a-z0-9]$/.test(_)){e.n=22;break}return ue({type:"error",text:"Bucket name format is invalid. Use lowercase letters, numbers, hyphens, underscores, and dots. Must start and end with a letter or number."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 22:if(!(_.length>63)){e.n=23;break}return ue({type:"error",text:"Bucket name is too long. Maximum 63 characters allowed."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 23:if(O=document.getElementById("auth_key"),T=pe&&pe instanceof File||O&&O.files&&O.files.length>0,P=$.auth_key&&""!==$.auth_key.trim(),T||P){e.n=24;break}return ue({type:"error",text:"Please upload a Google Cloud authentication key file (.json format)."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 24:if(C=null,pe&&pe instanceof File?C=pe:O&&O.files&&O.files.length>0?C=O.files[0]:(I=r.get("auth_key"))instanceof File&&(C=I),!(C&&C instanceof File&&C.size>0)){e.n=37;break}return e.p=25,(R=new FormData).append("auth_key",C),e.n=26,fetch(Bt("integrations/google-cloud-storage/upload-key"),{method:"POST",headers:{"X-WP-Nonce":F},body:R});case 26:return W=e.v,e.n=27,W.text();case 27:M=e.v;try{G=M?JSON.parse(M):{}}catch(e){G={success:!1,message:M||"Invalid upload response"}}if(G.success){e.n=28;break}return B=(null===(z=G.data)||void 0===z?void 0:z.message)||G.message||"Failed to upload authentication key file",ue({type:"error",text:B}),setTimeout(function(){return ue(null)},3e3),ae(!1),e.a(2);case 28:if(!(N=(null===(A=G.data)||void 0===A?void 0:A.filepath)||(null===(E=G.data)||void 0===E?void 0:E.filename)||G.filepath||G.filename)){e.n=29;break}o.auth_key=N,e.n=34;break;case 29:return ue({type:"info",text:"File uploaded. Reloading settings to get filepath..."}),e.n=30,new Promise(function(e){return setTimeout(e,500)});case 30:return e.p=30,e.n=31,fetch(Bt("integrations/".concat(tt)),{headers:{"X-WP-Nonce":F}});case 31:return U=e.v,e.n=32,U.json();case 32:(L=e.v).auth_key&&(o.auth_key=L.auth_key),e.n=34;break;case 33:e.p=33,e.v;case 34:e.n=36;break;case 35:return e.p=35,Je=e.v,ue({type:"error",text:"Failed to upload authentication key file: "+Je.message}),setTimeout(function(){return ue(null)},3e3),ae(!1),e.a(2);case 36:e.n=38;break;case 37:$.auth_key&&(o.auth_key=$.auth_key);case 38:H=Pt(r.entries()),e.p=39,H.s();case 40:if((V=H.n()).done){e.n=44;break}if(K=Dt(V.value,2),X=K[0],Y=K[1],"user_role_access"!==X){e.n=41;break}o[X]||(o[X]=[]),o[X].push(Y),e.n=43;break;case 41:if("auth_key"!==X||"google-cloud-storage"!==tt){e.n=42;break}return e.a(3,43);case 42:o[X]=Y;case 43:e.n=40;break;case 44:e.n=46;break;case 45:e.p=45,Ze=e.v,H.e(Ze);case 46:return e.p=46,H.f(),e.f(46);case 47:if(J=qe.current.find(function(e){return e.id===tt}),o.enable=null!=J&&J.enabled?"yes":"no",Z=function(e){return"string"==typeof e?e.trim():e||""},"dropbox"!==tt){e.n=49;break}if(Z(o.app_key)){e.n=48;break}return ue({type:"error",text:"App Key is required."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 48:if(Z(o.app_secret)){e.n=49;break}return ue({type:"error",text:"App Secret is required."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 49:if("onedrive"!==tt){e.n=51;break}if(Q=document.getElementById("app_id"),ee=document.getElementById("app_secret"),o.app_id&&String(o.app_id).trim()||!$.app_id||(o.app_id=$.app_id),o.app_secret&&String(o.app_secret).trim()||!$.app_secret||(o.app_secret=$.app_secret),!Q||o.app_id&&String(o.app_id).trim()||!Q.value||(o.app_id=Q.value),!ee||o.app_secret&&String(o.app_secret).trim()||!ee.value||(o.app_secret=ee.value),Z(o.app_id)){e.n=50;break}return ue({type:"error",text:"Application (client) ID is required."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 50:if(Z(o.app_secret)){e.n=51;break}return ue({type:"error",text:"Client secret is required."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 51:if("google-drive"!==tt){e.n=53;break}if(Z(o.app_key)){e.n=52;break}return ue({type:"error",text:"App Key is required."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 52:if(Z(o.app_secret)){e.n=53;break}return ue({type:"error",text:"App Secret is required."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 53:if("github"!==tt){e.n=55;break}if(Z(o.username)||(o.username=$.username||""),Z(o.pat)||(o.pat=$.pat||$.token||""),Z(o.username)){e.n=54;break}return ue({type:"error",text:"GitHub Username is required."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 54:if(Z(o.pat)){e.n=55;break}return ue({type:"error",text:"GitHub PAT is required."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 55:if("ai-code-assistent"!==tt){e.n=56;break}if("yes"!==o.enable||Z(o.gpt_api_key)){e.n=56;break}return ue({type:"error",text:"GPT API Key is required when AI integration is enabled."}),setTimeout(function(){return ue(null)},5e3),ae(!1),e.a(2);case 56:if("google-cloud-storage"===tt&&!o.auth_key&&$.auth_key&&(o.auth_key=$.auth_key),"ai-code-assistent"!==tt){e.n=57;break}if(!(te=(o.gpt_api_key||"").trim())){e.n=57;break}if(te.match(/^sk-[a-zA-Z0-9_-]{20,}$/)){e.n=57;break}return ue({type:"error",text:'Invalid API key format. Should start with "sk-" followed by alphanumeric characters, hyphens, or underscores.'}),setTimeout(function(){return ue(null)},3e3),ae(!1),e.a(2);case 57:return ne=Bt("integrations/".concat(tt)),e.p=58,e.n=59,fetch(ne,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":F},body:JSON.stringify(o)});case 59:return re=e.v,e.n=60,re.json();case 60:if(oe=e.v,!re.ok||!oe.success){e.n=95;break}if("google-cloud-storage"!==tt){e.n=70;break}return e.n=61,fetch(Bt("integrations/".concat(tt)),{headers:{"Content-Type":"application/json","X-WP-Nonce":F}});case 61:return ie=e.v,e.n=62,ie.json();case 62:if(se=e.v,q(se||{}),le=se.bucket||o.bucket||"",ce=se.auth_key||o.auth_key||"",!le||!ce){e.n=68;break}return e.p=63,e.n=64,fetch(Bt("integrations/google-cloud-storage/validate-bucket"),{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":F},body:JSON.stringify({bucket:le,auth_key:ce})});case 64:return de=e.v,e.n=65,de.json();case 65:fe=e.v,de.ok?fe.valid||fe.success?(ue({type:"success",text:oe.message||"Settings saved successfully! Bucket validated."}),setTimeout(function(){return ue(null)},3e3)):(me=Vt(fe.message||"Bucket validation failed.","google-cloud-storage"),ue({type:"error",text:"Settings saved, but bucket validation failed: ".concat(me)}),setTimeout(function(){return ue(null)},8e3)):(he=fe.message||(null===(ge=fe.data)||void 0===ge?void 0:ge.message)||fe.code||"Bucket validation failed.",ye=Vt(he,"google-cloud-storage"),ue({type:"error",text:"Settings saved, but bucket validation failed: ".concat(ye)}),setTimeout(function(){return ue(null)},8e3)),e.n=67;break;case 66:e.p=66,Qe=e.v,console.error("Error validating bucket:",Qe),ue({type:"success",text:oe.message||"Settings saved successfully!"}),setTimeout(function(){return ue(null)},3e3);case 67:e.n=69;break;case 68:ue({type:"success",text:oe.message||"Settings saved successfully!"}),setTimeout(function(){return ue(null)},3e3);case 69:e.n=94;break;case 70:if("amazon-s3"!==tt){e.n=80;break}return e.n=71,fetch(Bt("integrations/".concat(tt)),{headers:{"Content-Type":"application/json","X-WP-Nonce":F}});case 71:return be=e.v,e.n=72,be.json();case 72:if(xe=e.v,q(xe||{}),console.log("Settings reloaded after save:",xe),je=xe.bucket||o.bucket||"",we=xe.app_key||o.app_key||"",ke=xe.app_secret||o.app_secret||"",Se=xe.region||o.region||"",!(je&&we&&ke&&Se)){e.n=78;break}return console.log("Validating bucket using Amazon S3 library after save..."),e.p=73,e.n=74,fetch(Bt("integrations/amazon-s3/validate-bucket"),{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":F},body:JSON.stringify({bucket:je,app_key:we,app_secret:ke,region:Se})});case 74:return _e=e.v,e.n=75,_e.json();case 75:Oe=e.v,_e.ok?Oe.valid||Oe.success?(console.log("Bucket validation passed:",Oe.message||"Bucket is valid"),ue({type:"success",text:oe.message||"Settings saved successfully! Bucket validated."}),setTimeout(function(){return ue(null)},3e3)):(Ae=Vt(Oe.message||"Bucket validation failed."),console.log("Bucket validation failed:",Ae),ue({type:"error",text:"Settings saved, but bucket validation failed: ".concat(Ae)}),setTimeout(function(){return ue(null)},8e3)):(Pe=Oe.message||(null===(Te=Oe.data)||void 0===Te?void 0:Te.message)||Oe.code||"Bucket validation failed.",Ie=Vt(Pe),console.log("Bucket validation failed:",Ie,Oe),ue({type:"error",text:"Settings saved, but bucket validation failed: ".concat(Ie)}),setTimeout(function(){return ue(null)},8e3)),e.n=77;break;case 76:e.p=76,et=e.v,console.error("Error validating bucket:",et),ue({type:"success",text:oe.message||"Settings saved successfully!"}),setTimeout(function(){return ue(null)},3e3);case 77:e.n=79;break;case 78:ue({type:"success",text:oe.message||"Settings saved successfully!"}),setTimeout(function(){return ue(null)},3e3);case 79:e.n=94;break;case 80:if("wasabi"!==tt){e.n=90;break}return e.n=81,fetch(Bt("integrations/".concat(tt)),{headers:{"Content-Type":"application/json","X-WP-Nonce":F}});case 81:return Ee=e.v,e.n=82,Ee.json();case 82:if(Fe=e.v,q(Fe||{}),De=Fe.bucket||o.bucket||"",Re=Fe.access_key||o.access_key||"",We=Fe.secret_key||o.secret_key||"",Me=Fe.region||o.region||"",Ge=Fe.endpoint||o.endpoint||"",!(De&&Re&&We&&Me&&Ge)){e.n=88;break}return e.p=83,e.n=84,fetch(Bt("integrations/wasabi/validate-bucket"),{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":F},body:JSON.stringify({bucket:De,access_key:Re,secret_key:We,region:Me,endpoint:Ge})});case 84:return ze=e.v,e.n=85,ze.json();case 85:Be=e.v,ze.ok?Be.valid||Be.success?(ue({type:"success",text:oe.message||"Settings saved successfully! Wasabi connection OK."}),setTimeout(function(){return ue(null)},3e3)):(Le=Vt(Be.message||"Wasabi validation failed."),ue({type:"error",text:"Settings saved, but Wasabi check failed: ".concat(Le)}),setTimeout(function(){return ue(null)},8e3)):(Ue=Vt(Be.message||(null===(Ne=Be.data)||void 0===Ne?void 0:Ne.message)||Be.code||"Wasabi validation failed."),ue({type:"error",text:"Settings saved, but Wasabi check failed: ".concat(Ue)}),setTimeout(function(){return ue(null)},8e3)),e.n=87;break;case 86:e.p=86,e.v,ue({type:"success",text:oe.message||"Settings saved successfully!"}),setTimeout(function(){return ue(null)},3e3);case 87:e.n=89;break;case 88:ue({type:"success",text:oe.message||"Settings saved successfully!"}),setTimeout(function(){return ue(null)},3e3);case 89:e.n=94;break;case 90:return e.p=90,e.n=91,fetch(Bt("integrations/".concat(tt)),{headers:{"Content-Type":"application/json","X-WP-Nonce":F}});case 91:return He=e.v,e.n=92,He.json();case 92:Ve=e.v,q(Ve||{}),Ke(function(e){return e+1}),console.log("Settings reloaded after save:",Ve),"onedrive"===tt&&void 0!==Ve.is_connected&&ve(Ve.is_connected),"google-drive"===tt&&void 0!==Ve.is_connected&&Ce(Ve.is_connected),ue({type:"success",text:oe.message||"Settings saved successfully!"}),setTimeout(function(){return ue(null)},3e3),e.n=94;break;case 93:e.p=93,nt=e.v,console.error("Error reloading settings:",nt),ue({type:"success",text:oe.message||"Settings saved successfully!"}),setTimeout(function(){return ue(null)},3e3);case 94:if("ai-code-assistent"===tt&&sessionStorage.setItem("afm_ai_settings_changed","true"),"onedrive"===tt){sessionStorage.setItem("afm_onedrive_settings_changed","true"),sessionStorage.setItem("afm_filemanager_redirect","true");try{for(Xe=[],Ye=0;Ye<localStorage.length;Ye++)($e=localStorage.key(Ye))&&-1!==$e.indexOf("elfinder")&&Xe.push($e);Xe.forEach(function(e){try{localStorage.removeItem(e)}catch(e){}})}catch(e){}}e.n=96;break;case 95:ue({type:"error",text:oe.message||"Failed to save settings"}),setTimeout(function(){return ue(null)},3e3);case 96:e.n=98;break;case 97:e.p=97,rt=e.v,console.error("Error saving integration settings:",rt),ue({type:"error",text:"Failed to save settings"}),setTimeout(function(){return ue(null)},3e3);case 98:return e.p=98,ae(!1),e.f(98);case 99:return e.a(2)}},e,null,[[90,93],[83,86],[73,76],[63,66],[58,97,98,99],[39,45,46,47],[30,33],[25,35]])}));return function(t){return e.apply(this,arguments)}}(),ft=it.find(function(e){return e.id===tt});return window.location.origin,window.location.pathname,tt&&ft?(0,d.jsxs)("div",{className:"afm-tab-panel",children:[(0,d.jsx)("div",{className:"wrap",style:{background:"#fff",padding:"20px",border:"1px solid #ccc",position:"relative"},children:(0,d.jsxs)(Tt.A,{shouldShow:!D,children:[(0,d.jsx)("a",{href:"#",onClick:function(e){e.preventDefault(),function(){nt(null),q({}),ue(null),D&&Ze();var e="#/extension";if(window.history&&window.history.replaceState){var t=window.location.href.split("#")[0]+e;window.history.replaceState({},"",t)}else window.location.hash=e}()},style:{display:"inline-flex",alignItems:"center",color:"#3F6972",textDecoration:"none",fontSize:"14px",fontWeight:500,marginBottom:"20px",cursor:"pointer"},onMouseEnter:function(e){e.currentTarget.style.textDecoration="underline"},onMouseLeave:function(e){e.currentTarget.style.textDecoration="none"},children:"← Back To Integrations"}),(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-start",marginBottom:"30px",paddingBottom:"15px",borderBottom:"1px solid #e5e5e5",gap:"80px"},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[ft.iconImage&&(0,d.jsx)("img",{src:ft.iconImage,alt:"",style:{width:"24px",height:"24px",flexShrink:0}}),(0,d.jsxs)("h3",{style:{margin:0,fontSize:"18px",fontWeight:600,color:"#0f172a"},children:[ft.title," Settings"]})]}),(0,d.jsx)("div",{style:{display:"flex",alignItems:"center",margin:0,padding:0},children:(0,d.jsx)(st,{id:"".concat(ft.id,"_enable"),checked:ft.enabled,disabled:!D||"dropbox"===ft.id&&!M||"onedrive"===ft.id&&!z||"google-drive"===ft.id&&!G||"amazon-s3"===ft.id&&!B||"github"===ft.id&&!N||"google-cloud-storage"===ft.id&&!U||"pcloud"===ft.id&&!L||"cloudflare-r2"===ft.id&&!H||"wasabi"===ft.id&&!V||"digitalocean"===ft.id&&!K||"ai-code-assistent"===ft.id&&!X,onChange:function(){return lt(ft.id)}})})]}),le&&(0,d.jsxs)("div",{className:"afm-snackbar afm-snackbar-".concat("success"===le.type?"success":"info"===le.type?"info":"error"),onClick:function(){return ue(null)},style:{animation:"afm-slideIn 0.3s ease-out"},children:[(0,d.jsx)("span",{style:{fontSize:"14px",lineHeight:"1.5",flex:"1",wordBreak:"break-word"},children:le.text}),(0,d.jsx)("button",{type:"button",className:"afm-snackbar-close",onClick:function(e){e.preventDefault(),e.stopPropagation(),ue(null)},style:{background:"none",border:"none",padding:"0",cursor:"pointer",color:"inherit",fontSize:"18px",lineHeight:"1",marginLeft:"12px",opacity:"0.7",width:"20px",height:"20px",display:"flex",alignItems:"center",justifyContent:"center"},children:"×"})]}),te?(0,d.jsxs)("div",{style:{padding:"10px 0"},children:[(0,d.jsx)("style",{children:"\n                  @keyframes afm-skeleton-shimmer {\n                    0% { background-position: -200% 0; }\n                    100% { background-position: 200% 0; }\n                  }\n                  .afm-skeleton {\n                    background-color: #e2e8f0;\n                    background-image: linear-gradient(90deg, #e2e8f0 0%, #f1f5f9 50%, #e2e8f0 100%);\n                    background-size: 200% 100%;\n                    animation: afm-skeleton-shimmer 1.4s linear infinite;\n                  }\n                "}),(0,d.jsx)("div",{className:"afm-skeleton",style:{height:"22px",width:"220px",borderRadius:"6px",marginBottom:"20px"}}),(0,d.jsx)("div",{className:"afm-skeleton",style:{height:"42px",width:"100%",maxWidth:"500px",borderRadius:"6px",marginBottom:"14px"}}),(0,d.jsx)("div",{className:"afm-skeleton",style:{height:"42px",width:"100%",maxWidth:"500px",borderRadius:"6px",marginBottom:"14px"}}),(0,d.jsx)("div",{className:"afm-skeleton",style:{height:"42px",width:"100%",maxWidth:"500px",borderRadius:"6px",marginBottom:"14px"}}),(0,d.jsx)("div",{className:"afm-skeleton",style:{height:"42px",width:"100%",maxWidth:"500px",borderRadius:"6px",marginBottom:"24px"}}),(0,d.jsx)("div",{className:"afm-skeleton",style:{height:"40px",width:"160px",borderRadius:"6px"}})]}):(0,d.jsxs)("form",{onSubmit:dt,encType:"google-cloud-storage"===tt?"multipart/form-data":void 0,children:[(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"24px"},children:function(){if(!tt||!ft)return null;var e=$,t=window.location.origin+window.location.pathname;switch(e.redirect_uri||t||window.location.origin,tt){case"onedrive":return(0,d.jsx)(Tt.A,{shouldShow:D&&!z,children:(0,d.jsx)(ce,{settings:e,hasPro:D&&z,isConnected:xe,onConnect:function(){var t=e.redirect_uri||"";if(e.app_id&&e.app_secret&&t){var n=window.location.hash||"#/extension/onedrive";window.location.href="https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=".concat(encodeURIComponent(e.app_id),"&response_type=code&redirect_uri=").concat(encodeURIComponent(t),"&scope=files.readwrite.all%20offline_access&state=").concat(encodeURIComponent(n))}else ue&&(ue({type:"error",text:"Redirect URI is missing. Please reload the page and try again."}),setTimeout(function(){return ue(null)},4e3))},setMessage:ue,setShowDisconnectModal:We,setDisconnectIntegration:Be},"onedrive-".concat(Ve))});case"google-drive":return(0,d.jsx)(Tt.A,{shouldShow:D&&!G,children:(0,d.jsx)(he,{settings:e,hasPro:D&&G,isConnected:Pe,setShowDisconnectModal:We,setDisconnectIntegration:Be,setMessage:ue})});case"dropbox":return(0,d.jsx)(Tt.A,{shouldShow:D&&!M,children:(0,d.jsx)(re,{settings:e,hasPro:D&&M,root:E,nonce:F,setMessage:ue,isConnected:we,setShowDisconnectModal:We,setDisconnectIntegration:Be})});case"amazon-s3":return(0,d.jsx)(Tt.A,{shouldShow:D&&!B,children:(0,d.jsx)(v,{settings:e,hasPro:D&&B,root:E,nonce:F,setMessage:ue,onLibraryInstalled:ct})});case"github":return(0,d.jsx)(Tt.A,{shouldShow:D&&!N,children:(0,d.jsx)(Ge,{settings:e,hasPro:D&&N,root:E,nonce:F,setMessage:ue,onSettingsRefresh:ct})});case"google-cloud-storage":return(0,d.jsx)(Tt.A,{shouldShow:D&&!U,children:(0,d.jsx)(P,{settings:e,hasPro:D&&U,root:E,nonce:F,setMessage:ue,selectedAuthKeyFile:pe,setSelectedAuthKeyFile:fe,onLibraryInstalled:ct})});case"pcloud":return(0,d.jsx)(Tt.A,{shouldShow:D&&!L,children:(0,d.jsx)(rt,{settings:e,hasPro:D&&L,root:E,nonce:F,setMessage:ue,isConnected:_e,setShowDisconnectModal:We,setDisconnectIntegration:Be})});case"cloudflare-r2":return(0,d.jsx)(Tt.A,{shouldShow:D&&!H,children:(0,d.jsx)(pt,{settings:e,hasPro:D&&H,root:E,nonce:F,setMessage:ue})});case"wasabi":return(0,d.jsx)(Tt.A,{shouldShow:D&&!V,children:(0,d.jsx)(St,{settings:e,hasPro:D&&V,root:E,nonce:F,setMessage:ue,onLibraryInstalled:ct})});case"digitalocean":return(0,d.jsxs)("div",{style:{padding:"24px",textAlign:"center",background:"#f8f9fa",borderRadius:"8px",border:"1px solid #e9ecef"},children:[(0,d.jsx)("span",{style:{display:"inline-block",padding:"3px 8px",background:"#f0b90b",color:"#fff",borderRadius:"3px",fontSize:"10px",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:"12px"},children:"Coming Soon"}),(0,d.jsx)("p",{style:{margin:0,color:"#666",fontSize:"14px"},children:"DigitalOcean Spaces integration is under development. Connect and manage your DigitalOcean Spaces buckets directly from the Advanced File Manager."}),(0,d.jsx)("a",{href:W,target:"_blank",rel:"noopener noreferrer",style:Et(Et({},{color:"#3F6972",textDecoration:"underline"}),{},{marginTop:"12px",display:"inline-block"}),children:"Learn more"})]});case"ai-code-assistent":return(0,d.jsx)(Tt.A,{shouldShow:D&&!X,children:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(Ye,{settings:e,hasPro:D&&X,root:E,nonce:F,setMessage:ue,onApiKeyValidated:function(){return Le(!0)}}),(0,d.jsxs)("div",{style:{marginTop:"30px",padding:"20px",background:"#f8f9fa",borderRadius:"4px",border:"1px solid #e9ecef"},children:[(0,d.jsx)("h3",{style:{marginTop:0,marginBottom:"12px",fontSize:"16px",fontWeight:600},children:"How to Use Code Pilot"}),(0,d.jsxs)("ol",{style:{margin:0,paddingLeft:"20px",fontSize:"14px",color:"#666"},children:[(0,d.jsx)("li",{style:{marginBottom:"8px"},children:"Enter your OpenAI GPT API key above"}),(0,d.jsx)("li",{style:{marginBottom:"8px"},children:"Enable the AI Code Pilot integration using the toggle switch"}),(0,d.jsx)("li",{style:{marginBottom:"8px"},children:"Open any code file in the File Manager"}),(0,d.jsx)("li",{style:{marginBottom:"8px"},children:"Click the Code Pilot icon in the editor toolbar"}),(0,d.jsx)("li",{children:"Use AI-powered code suggestions and assistance"})]})]})]})});default:return(0,d.jsx)("div",{style:{padding:"20px",textAlign:"center",color:"#666"},children:"Settings form for this integration is not yet implemented."})}}()}),(0,d.jsx)("div",{style:{marginTop:"30px"},children:(0,d.jsx)("button",{type:"submit",disabled:!D||ie||"ai-code-assistent"===tt&&!Ue,style:{background:!D||ie||"ai-code-assistent"===tt&&!Ue?"#ccc":"#3F6972",color:"#fff",border:"none",borderRadius:"4px",padding:"12px 24px",fontSize:"14px",fontWeight:600,cursor:!D||ie||"ai-code-assistent"===tt&&!Ue?"not-allowed":"pointer",opacity:!D||ie||"ai-code-assistent"===tt&&!Ue?.5:1},onMouseEnter:function(e){!D||ie||"ai-code-assistent"===tt&&!Ue||(e.currentTarget.style.background="#2d555e")},onMouseLeave:function(e){!D||ie||"ai-code-assistent"===tt&&!Ue||(e.currentTarget.style.background="#3F6972")},children:ie?"Saving...":"Save Changes"})})]})]})}),Re&&ze&&(0,d.jsx)("div",{id:"afm-disconnect-modal",style:{position:"fixed",top:0,left:0,right:0,bottom:0,width:"100%",height:"100%",background:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:999999,margin:0,padding:0},onClick:function(){console.log("Modal backdrop clicked"),We(!1),Be(null)},children:(0,d.jsxs)("div",{id:"afm-disconnect-modal-content",style:{background:"#fff",borderRadius:"8px",minWidth:"400px",maxWidth:"90%",padding:"24px",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.2)",position:"relative",zIndex:1e6,margin:"20px"},onClick:function(e){e.stopPropagation(),console.log("Modal content clicked")},children:[(0,d.jsxs)("h3",{style:{margin:"0 0 16px 0",fontSize:"20px",fontWeight:600,color:"#1f2937"},children:["Disconnect ","dropbox"===ze?"Dropbox":"onedrive"===ze?"OneDrive":"google-drive"===ze?"Google Drive":"pcloud"===ze?"pCloud":"Integration","?"]}),(0,d.jsxs)("p",{style:{margin:"0 0 24px 0",color:"#6b7280",lineHeight:"1.6"},children:["Are you sure you want to disconnect ","dropbox"===ze?"Dropbox":"onedrive"===ze?"OneDrive":"google-drive"===ze?"Google Drive":"pcloud"===ze?"pCloud":"this integration","? You will need to reconnect to use this integration again."]}),(0,d.jsxs)("div",{style:{display:"flex",gap:"12px",justifyContent:"flex-end"},children:[(0,d.jsx)("button",{onClick:function(){We(!1),Be(null)},style:{padding:"10px 20px",background:"#f3f4f6",color:"#374151",border:"1px solid #d1d5db",borderRadius:"6px",fontSize:"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s"},onMouseOver:function(e){e.target.style.background="#e5e7eb"},onMouseOut:function(e){e.target.style.background="#f3f4f6"},children:"Cancel"}),(0,d.jsx)("button",{onClick:Gt(Ct().m(function e(){var t,n,r,o,i,a,s,l;return Ct().w(function(e){for(;;)switch(e.p=e.n){case 0:if("dropbox"!==ze){e.n=5;break}return e.p=1,e.n=2,Kt(Bt("integrations/dropbox/disconnect"),{method:"POST",headers:{"Content-Type":"application/json; charset=utf-8","X-WP-Nonce":F}});case 2:t=e.v,ke(!1),q(function(e){return Et(Et({},e||{}),{},{is_connected:!1})}),We(!1),Be(null),ue({type:"success",text:t.message||"Dropbox disconnected successfully!"}),setTimeout(function(){return ue(null)},3e3),e.n=4;break;case 3:e.p=3,i=e.v,console.error("Error disconnecting Dropbox:",i),We(!1),Be(null),ue({type:"error",text:i.message||"Failed to disconnect Dropbox"}),setTimeout(function(){return ue(null)},4e3);case 4:e.n=19;break;case 5:if("onedrive"!==ze){e.n=10;break}return e.p=6,e.n=7,Kt(Bt("integrations/onedrive/disconnect"),{method:"POST",headers:{"Content-Type":"application/json; charset=utf-8","X-WP-Nonce":F}});case 7:n=e.v,ve(!1),q(function(e){return Et(Et({},e||{}),{},{is_connected:!1})}),We(!1),Be(null),ue({type:"success",text:n.message||"OneDrive disconnected successfully!"}),setTimeout(function(){return ue(null)},3e3),e.n=9;break;case 8:e.p=8,a=e.v,console.error("Error disconnecting OneDrive:",a),We(!1),Be(null),ue({type:"error",text:a.message||"Failed to disconnect OneDrive"}),setTimeout(function(){return ue(null)},4e3);case 9:e.n=19;break;case 10:if("google-drive"!==ze){e.n=15;break}return e.p=11,e.n=12,Kt(Bt("integrations/googledrive/disconnect"),{method:"POST",headers:{"Content-Type":"application/json; charset=utf-8","X-WP-Nonce":F}});case 12:r=e.v,Ce(!1),q(function(e){return Et(Et({},e||{}),{},{is_connected:!1})}),We(!1),Be(null),ue({type:"success",text:r.message||"Google Drive disconnected successfully!"}),setTimeout(function(){return ue(null)},3e3),e.n=14;break;case 13:e.p=13,s=e.v,console.error("Error disconnecting Google Drive:",s),We(!1),Be(null),ue({type:"error",text:s.message||"Failed to disconnect Google Drive"}),setTimeout(function(){return ue(null)},4e3);case 14:e.n=19;break;case 15:if("pcloud"!==ze){e.n=19;break}return e.p=16,e.n=17,Kt(Bt("integrations/pcloud/disconnect"),{method:"POST",headers:{"Content-Type":"application/json; charset=utf-8","X-WP-Nonce":F}});case 17:o=e.v,Oe(!1),q(function(e){return Et(Et({},e||{}),{},{is_connected:!1})}),We(!1),Be(null),ue({type:"success",text:o.message||"pCloud disconnected successfully!"}),setTimeout(function(){return ue(null)},3e3),e.n=19;break;case 18:e.p=18,l=e.v,console.error("Error disconnecting pCloud:",l),We(!1),Be(null),ue({type:"error",text:l.message||"Failed to disconnect pCloud"}),setTimeout(function(){return ue(null)},4e3);case 19:return e.a(2)}},e,null,[[16,18],[11,13],[6,8],[1,3]])})),style:{padding:"10px 20px",background:"#dc2626",color:"#fff",border:"none",borderRadius:"6px",fontSize:"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s"},onMouseOver:function(e){e.target.style.background="#b91c1c"},onMouseOut:function(e){e.target.style.background="#dc2626"},children:"Disconnect"})]})]})})]}):(0,d.jsxs)("div",{className:"afm-tab-panel",children:[(0,d.jsxs)("div",{className:"wrap",style:{background:"#fff",padding:"20px",border:"1px solid #ccc",position:"relative"},children:[le&&(0,d.jsxs)("div",{className:"afm-snackbar afm-snackbar-".concat("success"===le.type?"success":"info"===le.type?"info":"error"),onClick:function(){return ue(null)},style:{animation:"afm-slideIn 0.3s ease-out"},children:[(0,d.jsx)("span",{style:{fontSize:"14px",lineHeight:"1.5",flex:"1",wordBreak:"break-word"},children:le.text}),(0,d.jsx)("button",{type:"button",className:"afm-snackbar-close",onClick:function(e){e.preventDefault(),e.stopPropagation(),ue(null)},style:{background:"none",border:"none",padding:"0",cursor:"pointer",color:"inherit",fontSize:"18px",lineHeight:"1",marginLeft:"12px",opacity:"0.7",width:"20px",height:"20px",display:"flex",alignItems:"center",justifyContent:"center"},children:"×"})]}),(0,d.jsx)(Tt.A,{shouldShow:!D,children:(0,d.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(320px, 1fr))",gap:"20px",marginTop:"20px"},children:Z?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("style",{children:"\n                  @keyframes afm-skeleton-shimmer {\n                    0% { background-position: -200% 0; }\n                    100% { background-position: 200% 0; }\n                  }\n                  .afm-skeleton {\n                    background-color: #e2e8f0;\n                    background-image: linear-gradient(90deg, #e2e8f0 0%, #f1f5f9 50%, #e2e8f0 100%);\n                    background-size: 200% 100%;\n                    animation: afm-skeleton-shimmer 1.4s linear infinite;\n                  }\n                "}),[1,2,3,4,5,6].map(function(e){return(0,d.jsxs)("div",{style:{background:"#fff",border:"1px solid #e5e5e5",borderRadius:"8px",padding:"20px",minHeight:"200px"},children:[(0,d.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"12px"},children:[(0,d.jsx)("div",{className:"afm-skeleton",style:{width:"48px",height:"48px",borderRadius:"8px"}}),(0,d.jsx)("div",{className:"afm-skeleton",style:{width:"80px",height:"20px",borderRadius:"4px"}})]}),(0,d.jsx)("div",{className:"afm-skeleton",style:{width:"160px",height:"20px",borderRadius:"4px",marginBottom:"10px"}}),(0,d.jsx)("div",{className:"afm-skeleton",style:{width:"100%",height:"14px",borderRadius:"4px",marginBottom:"8px"}}),(0,d.jsx)("div",{className:"afm-skeleton",style:{width:"85%",height:"14px",borderRadius:"4px",marginBottom:"20px"}}),(0,d.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"auto",paddingTop:"16px",borderTop:"1px solid #e5e5e5"},children:[(0,d.jsx)("div",{className:"afm-skeleton",style:{width:"80px",height:"14px",borderRadius:"4px"}}),(0,d.jsx)("div",{className:"afm-skeleton",style:{width:"44px",height:"24px",borderRadius:"12px"}})]})]},"integration-skeleton-".concat(e))})]}):it.map(function(e){return(0,d.jsxs)("div",{style:{background:"#fff",border:"1px solid #e5e5e5",borderRadius:"8px",padding:"20px",position:"relative",display:"flex",flexDirection:"column",minHeight:"200px",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",transition:"box-shadow 0.2s",cursor:D?e.hasSettings?"pointer":"default":"pointer"},onClick:function(t){D&&e.hasSettings&&(e.enabled||e.comingSoon)&&null===t.target.closest("button")&&null===t.target.closest(".afm-toggle-wrapper")&&ut(e.id)},onMouseEnter:function(e){D&&(e.currentTarget.style.boxShadow="0 4px 6px rgba(0,0,0,0.1)")},onMouseLeave:function(e){D&&(e.currentTarget.style.boxShadow="0 1px 3px rgba(0,0,0,0.1)")},children:[(0,d.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"12px"},children:[(0,d.jsx)("div",{style:{width:"48px",height:"48px",borderRadius:"8px",background:"image"===e.icon&&e.iconImage?"transparent":e.iconBg||"#f8f9fa",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"16px",fontWeight:600,color:e.iconColor||"#0f172a",overflow:"hidden"},children:"image"===e.icon&&e.iconImage?(0,d.jsx)("img",{src:e.iconImage,alt:e.title,style:{width:"100%",height:"100%",objectFit:"contain"}}):e.icon}),e.hasSettings&&e.enabled&&(0,d.jsxs)("button",{onClick:function(t){t.stopPropagation(),ut(e.id)},disabled:!D,style:{background:"transparent",border:"none",color:"#3F6972",cursor:D?"pointer":"not-allowed",fontSize:"14px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px",padding:"4px 8px",borderRadius:"4px",opacity:D?1:.5},onMouseEnter:function(e){D&&(e.currentTarget.style.background="#f0f0f0")},onMouseLeave:function(e){e.currentTarget.style.background="transparent"},children:[(0,d.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,d.jsx)("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"}),(0,d.jsx)("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),"Settings"]})]}),(0,d.jsxs)("h3",{style:{margin:"0 0 8px 0",fontSize:"18px",fontWeight:600,color:"#0f172a",lineHeight:"1.4",display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[e.title,e.comingSoon&&(0,d.jsx)("span",{style:{display:"inline-block",padding:"3px 8px",background:"#f0b90b",color:"#fff",fontSize:"10px",fontWeight:600,textTransform:"uppercase",borderRadius:"3px",letterSpacing:"0.5px"},children:"Coming Soon"})]}),(0,d.jsx)("p",{style:{margin:"0 0 auto 0",fontSize:"14px",color:"#666",lineHeight:"1.6",flex:1},children:e.description}),(0,d.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"16px",paddingTop:"16px",borderTop:"1px solid #e5e5e5"},children:[(0,d.jsx)("a",{href:e.learnMoreUrl,target:"_blank",rel:"noopener noreferrer",onClick:function(e){D||(e.preventDefault(),window.open(W,"_blank"))},style:{fontSize:"14px",color:"#3F6972",textDecoration:"none",fontWeight:500},onMouseEnter:function(e){e.currentTarget.style.textDecoration="underline"},onMouseLeave:function(e){e.currentTarget.style.textDecoration="none"},children:"Learn More"}),(0,d.jsx)(st,{id:e.id,checked:e.enabled,disabled:!D||e.comingSoon,onChange:function(){return lt(e.id)}})]})]},e.id)})})})]}),Re&&ze&&(0,d.jsx)("div",{id:"afm-disconnect-modal",style:{position:"fixed",top:0,left:0,right:0,bottom:0,width:"100%",height:"100%",background:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:999999,margin:0,padding:0},onClick:function(){console.log("Modal backdrop clicked"),We(!1),Be(null)},children:(0,d.jsxs)("div",{id:"afm-disconnect-modal-content",style:{background:"#fff",borderRadius:"8px",minWidth:"400px",maxWidth:"90%",padding:"24px",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.2)",position:"relative",zIndex:1e6,margin:"20px"},onClick:function(e){e.stopPropagation(),console.log("Modal content clicked")},children:[(0,d.jsxs)("h3",{style:{margin:"0 0 16px 0",fontSize:"20px",fontWeight:600,color:"#1f2937"},children:["Disconnect ","dropbox"===ze?"Dropbox":"onedrive"===ze?"OneDrive":"google-drive"===ze?"Google Drive":"pcloud"===ze?"pCloud":"Integration","?"]}),(0,d.jsxs)("p",{style:{margin:"0 0 24px 0",color:"#6b7280",lineHeight:"1.6"},children:["Are you sure you want to disconnect ","dropbox"===ze?"Dropbox":"onedrive"===ze?"OneDrive":"google-drive"===ze?"Google Drive":"pcloud"===ze?"pCloud":"this integration","? You will need to reconnect to use this integration again."]}),(0,d.jsxs)("div",{style:{display:"flex",gap:"12px",justifyContent:"flex-end"},children:[(0,d.jsx)("button",{onClick:function(){We(!1),Be(null)},style:{padding:"10px 20px",background:"#f3f4f6",color:"#374151",border:"1px solid #d1d5db",borderRadius:"6px",fontSize:"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s"},onMouseOver:function(e){e.target.style.background="#e5e7eb"},onMouseOut:function(e){e.target.style.background="#f3f4f6"},children:"Cancel"}),(0,d.jsx)("button",{onClick:Gt(Ct().m(function e(){var t,n,r,o,i,a,s,l;return Ct().w(function(e){for(;;)switch(e.p=e.n){case 0:if("dropbox"!==ze){e.n=5;break}return e.p=1,e.n=2,Kt(Bt("integrations/dropbox/disconnect"),{method:"POST",headers:{"Content-Type":"application/json; charset=utf-8","X-WP-Nonce":F}});case 2:t=e.v,ke(!1),q(function(e){return Et(Et({},e||{}),{},{is_connected:!1})}),We(!1),Be(null),ue({type:"success",text:t.message||"Dropbox disconnected successfully!"}),setTimeout(function(){return ue(null)},3e3),e.n=4;break;case 3:e.p=3,i=e.v,console.error("Error disconnecting Dropbox:",i),We(!1),Be(null),ue({type:"error",text:i.message||"Failed to disconnect Dropbox"}),setTimeout(function(){return ue(null)},4e3);case 4:e.n=19;break;case 5:if("onedrive"!==ze){e.n=10;break}return e.p=6,e.n=7,Kt(Bt("integrations/onedrive/disconnect"),{method:"POST",headers:{"Content-Type":"application/json; charset=utf-8","X-WP-Nonce":F}});case 7:n=e.v,ve(!1),q(function(e){return Et(Et({},e||{}),{},{is_connected:!1})}),We(!1),Be(null),ue({type:"success",text:n.message||"OneDrive disconnected successfully!"}),setTimeout(function(){return ue(null)},3e3),e.n=9;break;case 8:e.p=8,a=e.v,console.error("Error disconnecting OneDrive:",a),We(!1),Be(null),ue({type:"error",text:a.message||"Failed to disconnect OneDrive"}),setTimeout(function(){return ue(null)},4e3);case 9:e.n=19;break;case 10:if("google-drive"!==ze){e.n=15;break}return e.p=11,e.n=12,Kt(Bt("integrations/googledrive/disconnect"),{method:"POST",headers:{"Content-Type":"application/json; charset=utf-8","X-WP-Nonce":F}});case 12:r=e.v,Ce(!1),q(function(e){return Et(Et({},e||{}),{},{is_connected:!1})}),We(!1),Be(null),ue({type:"success",text:r.message||"Google Drive disconnected successfully!"}),setTimeout(function(){return ue(null)},3e3),e.n=14;break;case 13:e.p=13,s=e.v,console.error("Error disconnecting Google Drive:",s),We(!1),Be(null),ue({type:"error",text:s.message||"Failed to disconnect Google Drive"}),setTimeout(function(){return ue(null)},4e3);case 14:e.n=19;break;case 15:if("pcloud"!==ze){e.n=19;break}return e.p=16,e.n=17,Kt(Bt("integrations/pcloud/disconnect"),{method:"POST",headers:{"Content-Type":"application/json; charset=utf-8","X-WP-Nonce":F}});case 17:o=e.v,Oe(!1),q(function(e){return Et(Et({},e||{}),{},{is_connected:!1})}),We(!1),Be(null),ue({type:"success",text:o.message||"pCloud disconnected successfully!"}),setTimeout(function(){return ue(null)},3e3),e.n=19;break;case 18:e.p=18,l=e.v,console.error("Error disconnecting pCloud:",l),We(!1),Be(null),ue({type:"error",text:l.message||"Failed to disconnect pCloud"}),setTimeout(function(){return ue(null)},4e3);case 19:return e.a(2)}},e,null,[[16,18],[11,13],[6,8],[1,3]])})),style:{padding:"10px 20px",background:"#dc2626",color:"#fff",border:"none",borderRadius:"6px",fontSize:"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s"},onMouseOver:function(e){e.target.style.background="#b91c1c"},onMouseOut:function(e){e.target.style.background="#dc2626"},children:"Disconnect"})]})]})})]})}},5688(e,t,n){function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function i(){var e,t;return function(e){if(!e||"string"!=typeof e)return e;try{var t=new URL(e,window.location.origin);return t.protocol=window.location.protocol,t.host=window.location.host,t.toString()}catch(t){return e.startsWith("/")?"".concat(window.location.origin).concat(e):e}}((null===(e=window.wpApiSettings)||void 0===e?void 0:e.root)||(null===(t=window.afmReact)||void 0===t?void 0:t.jsonURL)||"".concat(window.location.origin,"/?rest_route=/"))}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=i(),o=n.endsWith("/")?n:"".concat(n,"/"),a=String(e||"").replace(/^\//,""),s=Object.entries(t).filter(function(e){var t=r(e,2)[1];return null!=t&&""!==t}).map(function(e){var t=r(e,2),n=t[0],o=t[1];return"".concat(encodeURIComponent(n),"=").concat(encodeURIComponent(String(o)))});if(o.includes("rest_route=")){var l="".concat(o.split("rest_route=")[0],"rest_route="),c="".concat(l,"/").concat(a);return s.length&&(c+="&".concat(s.join("&"))),c}if(o.includes("/wp-json")){var u=function(e){try{return new URL(e,window.location.origin).origin}catch(e){return window.location.origin}}(o),d="".concat(u,"/?rest_route=/").concat(a);return s.length&&(d+="&".concat(s.join("&"))),d}var p="".concat(o).concat(a);return s.length&&(p+="?".concat(s.join("&"))),p}n.d(t,{_H:()=>a,lA:()=>i})},7850(e,t,n){n.d(t,{w:()=>o});var r={basic:{dropbox:!1,googledrive:!1,onedrive:!1,amazons3:!1,github:!1,googlecloud:!1,pcloud:!1,cloudflarer2:!1,wasabi:!1,digitalocean:!1,email_notification:!0,slack_notification:!1,filelogs:!0,adminer:!1,frontend_access:!0,public_access:!0,role_based_access:!0,individual_access:!0,private_folders:!1,hide_sensitive_files:!0,multilingual:!0,flexible_view:!0,flexible_root:!0,operations_control:!0,complete_operations:!0,advance_themes:!1,gutenberg_blocks:!0,code_editor_themes:!1,ai_integration:!1},professional:{dropbox:!0,googledrive:!0,onedrive:!0,amazons3:!0,github:!0,googlecloud:!0,pcloud:!0,cloudflarer2:!0,wasabi:!0,digitalocean:!1,email_notification:!0,slack_notification:!0,filelogs:!0,adminer:!1,frontend_access:!0,public_access:!0,role_based_access:!0,individual_access:!0,private_folders:!0,hide_sensitive_files:!0,multilingual:!0,flexible_view:!0,flexible_root:!0,operations_control:!0,complete_operations:!0,advance_themes:!0,gutenberg_blocks:!0,code_editor_themes:!0,ai_integration:!1},business:{dropbox:!0,googledrive:!0,onedrive:!0,amazons3:!0,github:!0,googlecloud:!0,pcloud:!0,cloudflarer2:!0,wasabi:!0,digitalocean:!1,email_notification:!0,slack_notification:!0,filelogs:!0,adminer:!0,frontend_access:!0,public_access:!0,role_based_access:!0,individual_access:!0,private_folders:!0,hide_sensitive_files:!0,multilingual:!0,flexible_view:!0,flexible_root:!0,operations_control:!0,complete_operations:!0,advance_themes:!0,gutenberg_blocks:!0,code_editor_themes:!0,ai_integration:!0}};function o(e,t,n){return!!n&&"free"!==t&&!!r[t]&&!0===r[t][e]}}}]);
//# sourceMappingURL=906.83d62c0b.chunk.js.map

Youez - 2016 - github.com/yon3zu
LinuXploit